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;
int A[200005];
int B[200005];
int C[200005];
signed main() {
cin.sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int K, M;
cin >> K >> M;
string s;
cin >> s;
int N;
cin >> N;
int i, j;
for(i=0;i<N;i++) cin >> A[i] >> B[i] >> C[i];
for(i=0;i<K;i++) {
int pt = i;
for(j=N-1;j>=0;j--) {
if(C[j] <= pt) {
int len = B[j] - A[j];
if(pt >= C[j] + len) {
pt -= len;
}
else {
pt += A[j] - C[j];
}
}
}
//cout << pt << ' ';
cout << s[pt];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |