이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |