Submission #56886

# Submission time Handle Problem Language Result Execution time Memory
56886 2018-07-13T05:13:35 Z 노영훈(#1634) 복사 붙여넣기 2 (JOI15_copypaste2) C++11
100 / 100
373 ms 3152 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=200010, inf=2e9;

int n, m, k;
struct comm {
    int l, r, s;
} C[MX];
char S[MX]; int sz;

char solve(int x, int t=n){
    if(t==0) return S[x];

    int l=C[t].l, r=C[t].r;
    int s=C[t].s, e=s+r-l;

    if(s<=x && x<e) return solve(x-s+l, t-1);
    if(x<s) return solve(x, t-1);
    if(e<=x) return solve(x-(r-l), t-1);
    return '0';
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cin>>k>>m;
    cin>>S;

    cin>>n;
    for(int i=1; i<=n; i++){
        int l, r, s; cin>>l>>r>>s;
        C[i]={l,r,s};
    }

    for(int i=0; i<k; i++){
        cout<<solve(i);
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 4 ms 464 KB Output is correct
3 Correct 6 ms 464 KB Output is correct
4 Correct 5 ms 508 KB Output is correct
5 Correct 4 ms 548 KB Output is correct
6 Correct 4 ms 548 KB Output is correct
7 Correct 4 ms 548 KB Output is correct
8 Correct 5 ms 548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 4 ms 464 KB Output is correct
3 Correct 6 ms 464 KB Output is correct
4 Correct 5 ms 508 KB Output is correct
5 Correct 4 ms 548 KB Output is correct
6 Correct 4 ms 548 KB Output is correct
7 Correct 4 ms 548 KB Output is correct
8 Correct 5 ms 548 KB Output is correct
9 Correct 308 ms 3004 KB Output is correct
10 Correct 163 ms 3004 KB Output is correct
11 Correct 166 ms 3044 KB Output is correct
12 Correct 317 ms 3044 KB Output is correct
13 Correct 167 ms 3044 KB Output is correct
14 Correct 220 ms 3108 KB Output is correct
15 Correct 164 ms 3152 KB Output is correct
16 Correct 168 ms 3152 KB Output is correct
17 Correct 303 ms 3152 KB Output is correct
18 Correct 128 ms 3152 KB Output is correct
19 Correct 107 ms 3152 KB Output is correct
20 Correct 101 ms 3152 KB Output is correct
21 Correct 114 ms 3152 KB Output is correct
22 Correct 130 ms 3152 KB Output is correct
23 Correct 133 ms 3152 KB Output is correct
24 Correct 191 ms 3152 KB Output is correct
25 Correct 243 ms 3152 KB Output is correct
26 Correct 373 ms 3152 KB Output is correct