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<iostream>
#include<algorithm>
#include<string>
using namespace std;
int l[200010], r[200010], p[200010];
string a;
int dap[200010];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n, m, k;
cin >> n >> m >> a >> k;
for (int i = 0; i < k; i++)
cin >> l[i] >> r[i] >> p[i];
for (int i = 0; i < n; i++) {
int pos = i;
for (int y = k - 1; y >= 0; y--) {
int len = r[y] - l[y];
if (pos >= p[y] + len)
pos -= len;
else if (pos >= p[y]) {
pos = pos - p[y] + l[y];
}
}
cout << a[pos];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |