# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
56884 | 2018-07-13T05:12:17 Z | 윤교준(#1636) | 복사 붙여넣기 2 (JOI15_copypaste2) | C++11 | 322 ms | 4032 KB |
#include <bits/stdc++.h> #define pb push_back #define eb emplace_back #define sz(V) ((int)(V).size()) #define allv(V) ((V).begin()),((V).end()) #define befv(V) ((V)[(sz(V)-2)]) #define sorv(V) sort(allv(V)) #define revv(V) reverse(allv(V)) #define univ(V) (V).erase(unique(allv(V)),(V).end()) #define clv(V) (V).clear() #define upmin(a,b) (a)=min((a),(b)) #define upmax(a,b) (a)=max((a),(b)) #define rb(x) ((x)&(-(x))) #define cb(x) (x)=(!(x)) #define INF (0x3f3f3f3f) #define INFLL (0x3f3f3f3f3f3f3f3fll) using namespace std; typedef long long ll; const int MAXN = 205; const int MAXK = 200005; int A[MAXK], B[MAXK], C[MAXK], L[MAXK]; char S[222222]; int N, K; int main() { scanf("%d%*d", &N); scanf(" %s", S); scanf("%d", &K); for(int i = 1; i <= K; i++) scanf("%d%d%d", &A[i], &B[i], &C[i]); for(int i = 1; i <= K; i++) B[i]--; for(int i = 1; i <= K; i++) L[i] = B[i] - A[i] + 1; for(int xi = 0; xi < N; xi++) { int x = xi; for(int qi = K; qi; qi--) { //printf("xi=%d, qi=%d, x=%d\n", xi, qi, x); if(x < C[qi]) continue; if(C[qi] + L[qi] <= x) { x -= L[qi]; continue; } int di = x - C[qi]; x = A[qi] + di; } //printf("FINAL xi=%d, x=%d\n", xi, x); putchar(S[x]); } puts(""); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 6 ms | 488 KB | Output is correct |
3 | Correct | 5 ms | 488 KB | Output is correct |
4 | Correct | 4 ms | 488 KB | Output is correct |
5 | Correct | 3 ms | 512 KB | Output is correct |
6 | Correct | 3 ms | 588 KB | Output is correct |
7 | Correct | 3 ms | 704 KB | Output is correct |
8 | Correct | 3 ms | 704 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 6 ms | 488 KB | Output is correct |
3 | Correct | 5 ms | 488 KB | Output is correct |
4 | Correct | 4 ms | 488 KB | Output is correct |
5 | Correct | 3 ms | 512 KB | Output is correct |
6 | Correct | 3 ms | 588 KB | Output is correct |
7 | Correct | 3 ms | 704 KB | Output is correct |
8 | Correct | 3 ms | 704 KB | Output is correct |
9 | Correct | 291 ms | 3792 KB | Output is correct |
10 | Correct | 159 ms | 3816 KB | Output is correct |
11 | Correct | 147 ms | 3816 KB | Output is correct |
12 | Correct | 322 ms | 3816 KB | Output is correct |
13 | Correct | 128 ms | 3944 KB | Output is correct |
14 | Correct | 121 ms | 3944 KB | Output is correct |
15 | Correct | 126 ms | 4032 KB | Output is correct |
16 | Correct | 132 ms | 4032 KB | Output is correct |
17 | Correct | 305 ms | 4032 KB | Output is correct |
18 | Correct | 125 ms | 4032 KB | Output is correct |
19 | Correct | 142 ms | 4032 KB | Output is correct |
20 | Correct | 120 ms | 4032 KB | Output is correct |
21 | Correct | 133 ms | 4032 KB | Output is correct |
22 | Correct | 152 ms | 4032 KB | Output is correct |
23 | Correct | 203 ms | 4032 KB | Output is correct |
24 | Correct | 170 ms | 4032 KB | Output is correct |
25 | Correct | 226 ms | 4032 KB | Output is correct |
26 | Correct | 291 ms | 4032 KB | Output is correct |