# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95422 | 2019-02-01T04:31:40 Z | Retro3014 | 복사 붙여넣기 2 (JOI15_copypaste2) | C++17 | 250 ms | 8700 KB |
#include <iostream> #include <vector> #include <algorithm> #include <stdio.h> #include <string> using namespace std; int K, M, N; string str; struct S{ int a, b, c; }; vector<S> v; int main(){ scanf("%d%d", &K, &M); cin>>str; scanf("%d", &N); for(int i=0; i<N; i++){ S tmp; scanf("%d%d%d", &tmp.a, &tmp.b, &tmp.c); tmp.b--; v.push_back(tmp); } for(int index=0; index<K; index++){ int idx = index; for(int i=v.size()-1; i>=0; i--){ //cout<<idx<<" "; int s = v[i].c, e = v[i].c-v[i].a+v[i].b; if(idx<s){ continue; }else if(s<=idx && idx<=e){ idx = idx-v[i].c+v[i].a; }else{ idx-=(e-s+1); } } //cout<<endl; printf("%c", str[idx]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 235 ms | 8572 KB | Output is correct |
10 | Correct | 120 ms | 8696 KB | Output is correct |
11 | Correct | 133 ms | 8700 KB | Output is correct |
12 | Correct | 250 ms | 8696 KB | Output is correct |
13 | Correct | 122 ms | 8436 KB | Output is correct |
14 | Correct | 118 ms | 8440 KB | Output is correct |
15 | Correct | 121 ms | 8448 KB | Output is correct |
16 | Correct | 120 ms | 8500 KB | Output is correct |
17 | Correct | 220 ms | 8380 KB | Output is correct |
18 | Correct | 90 ms | 8672 KB | Output is correct |
19 | Correct | 90 ms | 8544 KB | Output is correct |
20 | Correct | 94 ms | 8548 KB | Output is correct |
21 | Correct | 103 ms | 8680 KB | Output is correct |
22 | Correct | 112 ms | 8548 KB | Output is correct |
23 | Correct | 120 ms | 8552 KB | Output is correct |
24 | Correct | 147 ms | 8664 KB | Output is correct |
25 | Correct | 206 ms | 8544 KB | Output is correct |
26 | Correct | 247 ms | 8544 KB | Output is correct |