Submission #677448

# Submission time Handle Problem Language Result Execution time Memory
677448 2023-01-03T11:31:59 Z onjo0127 복사 붙여넣기 2 (JOI15_copypaste2) C++11
100 / 100
229 ms 3656 KB
#include <bits/stdc++.h>
using namespace std;

char S[200009];
int A[200009], B[200009], C[200009];

int main() {
	int K, M; scanf("%d%d", &K, &M);
	scanf(" %s", S);
	int N; scanf("%d", &N);
	for(int i=0; i<N; i++) scanf("%d%d%d", &A[i], &B[i], &C[i]);
	for(int i=0; i<K; i++) {
		int f = i;
		for(int j=N-1; j>=0; j--) {
			if(C[j] <= f && f < C[j] + B[j] - A[j]) {
				f = A[j] + f - C[j];
			}
			else if(C[j] <= f) {
				f -= B[j] - A[j];
			}
		}
		printf("%c", S[f]);
	}
	return 0;
}

Compilation message

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:8:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  int K, M; scanf("%d%d", &K, &M);
      |            ~~~~~^~~~~~~~~~~~~~~~
copypaste2.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf(" %s", S);
      |  ~~~~~^~~~~~~~~~
copypaste2.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  int N; scanf("%d", &N);
      |         ~~~~~^~~~~~~~~~
copypaste2.cpp:11:30: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  for(int i=0; i<N; i++) scanf("%d%d%d", &A[i], &B[i], &C[i]);
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 320 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 2 ms 360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 320 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 2 ms 360 KB Output is correct
9 Correct 199 ms 3436 KB Output is correct
10 Correct 84 ms 3400 KB Output is correct
11 Correct 68 ms 3300 KB Output is correct
12 Correct 204 ms 3420 KB Output is correct
13 Correct 73 ms 3608 KB Output is correct
14 Correct 70 ms 3500 KB Output is correct
15 Correct 71 ms 3476 KB Output is correct
16 Correct 67 ms 3656 KB Output is correct
17 Correct 214 ms 3332 KB Output is correct
18 Correct 58 ms 3340 KB Output is correct
19 Correct 59 ms 3344 KB Output is correct
20 Correct 59 ms 3380 KB Output is correct
21 Correct 67 ms 3420 KB Output is correct
22 Correct 78 ms 3308 KB Output is correct
23 Correct 87 ms 3448 KB Output is correct
24 Correct 116 ms 3404 KB Output is correct
25 Correct 156 ms 3404 KB Output is correct
26 Correct 229 ms 3308 KB Output is correct