Submission #44503903
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll _=2e5+5,I=1e9;
ll n,m;
string s,t;
vector<ll>v[_];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n>>m>>s;t=s;
for(ll i=0,x;i<n;i++)cin>>x,v[x].push_back(i);
for(ll i=1;i<=m;i++)v[i].push_back(v[i][0]);
for(ll i=1;i<=m;i++)
for(ll j=0;j<v[i].size()-1;j++)t[v[i][j+1]]=s[v[i][j]];
cout<<t<<'\n';
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Rotate Colored Subsequence |
| User | liruixuan |
| Language | C++ 20 (gcc 12.2) |
| Score | 300 |
| Code Size | 428 Byte |
| Status | AC |
| Exec Time | 34 ms |
| Memory | 14552 KiB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:15:29: warning: comparison of integer expressions of different signedness: ‘ll’ {aka ‘long long int’} and ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
15 | for(ll j=0;j<v[i].size()-1;j++)t[v[i][j+1]]=s[v[i][j]];
| ~^~~~~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, example0.txt, example1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 2 ms | 3444 KiB |
| 001.txt | AC | 9 ms | 5528 KiB |
| 002.txt | AC | 33 ms | 14444 KiB |
| 003.txt | AC | 9 ms | 5384 KiB |
| 004.txt | AC | 11 ms | 5912 KiB |
| 005.txt | AC | 20 ms | 7152 KiB |
| 006.txt | AC | 8 ms | 5304 KiB |
| 007.txt | AC | 12 ms | 7360 KiB |
| 008.txt | AC | 12 ms | 6096 KiB |
| 009.txt | AC | 34 ms | 14552 KiB |
| 010.txt | AC | 16 ms | 6668 KiB |
| 011.txt | AC | 10 ms | 5900 KiB |
| 012.txt | AC | 10 ms | 5700 KiB |
| 013.txt | AC | 9 ms | 5628 KiB |
| 014.txt | AC | 9 ms | 6224 KiB |
| 015.txt | AC | 8 ms | 5804 KiB |
| 016.txt | AC | 9 ms | 6224 KiB |
| 017.txt | AC | 8 ms | 5596 KiB |
| 018.txt | AC | 9 ms | 5568 KiB |
| 019.txt | AC | 9 ms | 5608 KiB |
| 020.txt | AC | 9 ms | 5912 KiB |
| 021.txt | AC | 9 ms | 5348 KiB |
| 022.txt | AC | 8 ms | 5376 KiB |
| 023.txt | AC | 9 ms | 5832 KiB |
| 024.txt | AC | 9 ms | 5312 KiB |
| 025.txt | AC | 9 ms | 5540 KiB |
| 026.txt | AC | 8 ms | 5660 KiB |
| example0.txt | AC | 2 ms | 3436 KiB |
| example1.txt | AC | 1 ms | 3428 KiB |