# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
198920 | arnold518 | 복사 붙여넣기 2 (JOI15_copypaste2) | C++14 | 316 ms | 12536 KiB |
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;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 2e5;
int K, N;
ll A[MAXN+10], B[MAXN+10], C[MAXN+10], D[MAXN+10];
char S[MAXN+10];
int main()
{
int i, j;
scanf("%d%*d%s%d", &K, S, &N);
for(i=1; i<=N; i++)
{
scanf("%lld%lld%lld", &A[i], &B[i], &C[i]);
B[i]--;
D[i]=C[i]+B[i]-A[i];
}
for(i=0; i<K; i++)
{
int pos=i;
for(j=N; j>=1; j--)
{
if(C[j]<=pos && pos<=D[j]) pos=pos-C[j]+A[j];
else if(D[j]<pos) pos-=D[j]-C[j]+1;
}
printf("%c", S[pos]);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |