답안 #126586

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
126586 2019-07-08T07:01:11 Z ainta 단층 (JOI16_ho_t5) C++17
34 / 100
2000 ms 4728 KB
#include<cstdio>
#include<algorithm>
using namespace std;
int n, Q;
struct Query {
	int x, ck, l;
}w[201000];
int main() {
	int i, j;
	scanf("%d%d", &n, &Q);
	for (i = 1; i <= Q; i++) {
		scanf("%d%d%d", &w[i].x, &w[i].ck, &w[i].l);
		if (w[i].ck == 1) w[i].x--;
	}
	for (i = 0; i < n; i++) {
		long long X = i, Y = i;
		for (j = Q; j >= 1; j--) {
			if (w[j].ck == 1) {
				if (w[j].x >= X) {
					Y -= 2 * w[j].l;
				}
			}
			else {
				if (w[j].x <= Y) {
					X += 2 * w[j].l;
				}
			}
		}
		printf("%lld\n", (X - Y) / 2);
	}
}

Compilation message

2016_ho_t5.cpp: In function 'int main()':
2016_ho_t5.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &Q);
  ~~~~~^~~~~~~~~~~~~~~~
2016_ho_t5.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &w[i].x, &w[i].ck, &w[i].l);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 380 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 296 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 380 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 296 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 45 ms 412 KB Output is correct
29 Correct 36 ms 376 KB Output is correct
30 Correct 28 ms 376 KB Output is correct
31 Correct 45 ms 436 KB Output is correct
32 Correct 27 ms 376 KB Output is correct
33 Correct 41 ms 504 KB Output is correct
34 Correct 49 ms 380 KB Output is correct
35 Correct 34 ms 420 KB Output is correct
36 Correct 36 ms 376 KB Output is correct
37 Correct 43 ms 376 KB Output is correct
38 Correct 48 ms 380 KB Output is correct
39 Correct 43 ms 376 KB Output is correct
40 Correct 46 ms 376 KB Output is correct
41 Correct 48 ms 504 KB Output is correct
42 Correct 48 ms 436 KB Output is correct
43 Correct 34 ms 504 KB Output is correct
44 Correct 36 ms 504 KB Output is correct
45 Correct 46 ms 376 KB Output is correct
46 Correct 28 ms 504 KB Output is correct
47 Correct 30 ms 504 KB Output is correct
48 Correct 15 ms 376 KB Output is correct
49 Correct 12 ms 376 KB Output is correct
50 Correct 13 ms 376 KB Output is correct
51 Correct 13 ms 376 KB Output is correct
52 Correct 12 ms 376 KB Output is correct
53 Correct 12 ms 380 KB Output is correct
54 Correct 12 ms 504 KB Output is correct
55 Correct 11 ms 376 KB Output is correct
56 Correct 12 ms 376 KB Output is correct
57 Correct 13 ms 376 KB Output is correct
58 Correct 12 ms 376 KB Output is correct
59 Correct 12 ms 376 KB Output is correct
60 Correct 12 ms 376 KB Output is correct
61 Correct 12 ms 376 KB Output is correct
62 Correct 30 ms 376 KB Output is correct
63 Correct 30 ms 376 KB Output is correct
64 Correct 30 ms 376 KB Output is correct
65 Correct 32 ms 420 KB Output is correct
66 Correct 31 ms 376 KB Output is correct
67 Correct 31 ms 376 KB Output is correct
68 Correct 32 ms 376 KB Output is correct
69 Correct 31 ms 380 KB Output is correct
70 Correct 2 ms 256 KB Output is correct
71 Correct 2 ms 376 KB Output is correct
72 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 380 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 296 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 45 ms 412 KB Output is correct
29 Correct 36 ms 376 KB Output is correct
30 Correct 28 ms 376 KB Output is correct
31 Correct 45 ms 436 KB Output is correct
32 Correct 27 ms 376 KB Output is correct
33 Correct 41 ms 504 KB Output is correct
34 Correct 49 ms 380 KB Output is correct
35 Correct 34 ms 420 KB Output is correct
36 Correct 36 ms 376 KB Output is correct
37 Correct 43 ms 376 KB Output is correct
38 Correct 48 ms 380 KB Output is correct
39 Correct 43 ms 376 KB Output is correct
40 Correct 46 ms 376 KB Output is correct
41 Correct 48 ms 504 KB Output is correct
42 Correct 48 ms 436 KB Output is correct
43 Correct 34 ms 504 KB Output is correct
44 Correct 36 ms 504 KB Output is correct
45 Correct 46 ms 376 KB Output is correct
46 Correct 28 ms 504 KB Output is correct
47 Correct 30 ms 504 KB Output is correct
48 Correct 15 ms 376 KB Output is correct
49 Correct 12 ms 376 KB Output is correct
50 Correct 13 ms 376 KB Output is correct
51 Correct 13 ms 376 KB Output is correct
52 Correct 12 ms 376 KB Output is correct
53 Correct 12 ms 380 KB Output is correct
54 Correct 12 ms 504 KB Output is correct
55 Correct 11 ms 376 KB Output is correct
56 Correct 12 ms 376 KB Output is correct
57 Correct 13 ms 376 KB Output is correct
58 Correct 12 ms 376 KB Output is correct
59 Correct 12 ms 376 KB Output is correct
60 Correct 12 ms 376 KB Output is correct
61 Correct 12 ms 376 KB Output is correct
62 Correct 30 ms 376 KB Output is correct
63 Correct 30 ms 376 KB Output is correct
64 Correct 30 ms 376 KB Output is correct
65 Correct 32 ms 420 KB Output is correct
66 Correct 31 ms 376 KB Output is correct
67 Correct 31 ms 376 KB Output is correct
68 Correct 32 ms 376 KB Output is correct
69 Correct 31 ms 380 KB Output is correct
70 Correct 2 ms 256 KB Output is correct
71 Correct 2 ms 376 KB Output is correct
72 Correct 2 ms 376 KB Output is correct
73 Execution timed out 2070 ms 4728 KB Time limit exceeded
74 Halted 0 ms 0 KB -