This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define MP(a,b) make_pair(a,b)
int K,M,N;
string S;
int moto[200];
int L[200000],R[200000],P[200000]; //0-index [l,r) p no mae
int main(){
cin >> K >> M >> S >> N;
for(int i=0; i<K; i++) moto[i] = i;
for(int i=0; i<N; i++){
cin >> L[i] >> R[i] >> P[i];
}
for(int i=N-1; i>=0; i--){
//kopipe saki
int l = P[i];
int m = R[i]-L[i];
int r = P[i]+m; //[l,r)
for(int j=0; j<K; j++){
//cout << moto[j] << " ";
if(l <= moto[j] && moto[j] < r){
moto[j] = L[i]+(moto[j]-l);
}
else if(P[i] < moto[j]) moto[j] -= m;
}
//cout << endl;
}
for(int i=0; i<K; i++) cout << S[moto[i]];
cout << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |