답안 #1049453

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1049453 2024-08-08T18:57:48 Z rainboy Bring Down the Grading Server (CEOI23_gradingserver) C
65 / 100
4000 ms 7628 KB
#include <stdio.h>
 
long long min(long long a, long long b) { return a < b ? a : b; }
 
int c;
 
int solve(long long x1, long long y1, long long x2, long long y2) {
	long long y;
 
	if (x1 + y1 * c <= 0)
		return 0;
	if (x2 + y2 * c <= 0)
		return 1;
	if (x1 <= 0) {
		if (x2 > 0) {
			if (x2 >= c)
				return 0;
			if (y2 > 0) {
				if (x2 - x1 >= c)
					return 0;
				return !solve(x2, y2, x1 + c, y1 - 1);
			}
			y = -x1 / (c - x2) + 1;
			return y <= y1 && solve(x1 + y * (c - x2), y1 - y, x2, y2);
		} else {
			y = min(-x1 / c + 1, -x2 / c + 1);
			return solve(x1 + y * c, y1 - y, x2 + y * c, y2 - y);
		}
	}
	if (x1 >= x2 && (x1 >= c || y1 > 0))
		return 1;
	if (x2 < c && x1 + y1 * (c - x2) >= c)
		return 1;
	if (!solve(x2 - x1, y2, x1, y1))
		return 1;
	if (x2 >= c || y1 == 0)
		return 0;
	return solve(x1 + (c - x2) * y1, 0, x2, y2) || solve(x1 + c - x2, y1 - 1, x2, y2);
}
 
int main() {
	int t;
 
	scanf("%d%d", &c, &t);
	while (t--) {
		long long x1, y1, x2, y2;
 
		scanf("%lld%lld%lld%lld", &x1, &y2, &x2, &y1), x1 -= y1 * c, x2 -= y2 * c;
		printf(solve(x1, y1, x2, y2) ? "YES\n" : "NO\n");
	}
	return 0;
}

Compilation message

gradingserver.c: In function 'main':
gradingserver.c:44:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |  scanf("%d%d", &c, &t);
      |  ^~~~~~~~~~~~~~~~~~~~~
gradingserver.c:48:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |   scanf("%lld%lld%lld%lld", &x1, &y2, &x2, &y1), x1 -= y1 * c, x2 -= y2 * c;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 43 ms 2600 KB Output is correct
3 Correct 54 ms 2920 KB Output is correct
4 Correct 53 ms 2896 KB Output is correct
5 Correct 43 ms 2900 KB Output is correct
6 Correct 46 ms 2896 KB Output is correct
7 Correct 46 ms 2896 KB Output is correct
8 Correct 64 ms 2896 KB Output is correct
9 Correct 42 ms 3016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 43 ms 2600 KB Output is correct
3 Correct 54 ms 2920 KB Output is correct
4 Correct 53 ms 2896 KB Output is correct
5 Correct 43 ms 2900 KB Output is correct
6 Correct 46 ms 2896 KB Output is correct
7 Correct 46 ms 2896 KB Output is correct
8 Correct 64 ms 2896 KB Output is correct
9 Correct 42 ms 3016 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 43 ms 2896 KB Output is correct
12 Correct 45 ms 2896 KB Output is correct
13 Correct 46 ms 2900 KB Output is correct
14 Correct 46 ms 2900 KB Output is correct
15 Correct 46 ms 2896 KB Output is correct
16 Correct 62 ms 2900 KB Output is correct
17 Correct 46 ms 2900 KB Output is correct
18 Correct 42 ms 2896 KB Output is correct
19 Correct 51 ms 3428 KB Output is correct
20 Correct 50 ms 3152 KB Output is correct
21 Correct 76 ms 3412 KB Output is correct
22 Correct 50 ms 3412 KB Output is correct
23 Correct 48 ms 3504 KB Output is correct
24 Correct 48 ms 3156 KB Output is correct
25 Correct 49 ms 3404 KB Output is correct
26 Correct 46 ms 3412 KB Output is correct
27 Correct 54 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 7508 KB Output is correct
2 Correct 77 ms 7044 KB Output is correct
3 Correct 87 ms 7304 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 43 ms 2600 KB Output is correct
3 Correct 54 ms 2920 KB Output is correct
4 Correct 53 ms 2896 KB Output is correct
5 Correct 43 ms 2900 KB Output is correct
6 Correct 46 ms 2896 KB Output is correct
7 Correct 46 ms 2896 KB Output is correct
8 Correct 64 ms 2896 KB Output is correct
9 Correct 42 ms 3016 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 43 ms 2896 KB Output is correct
12 Correct 45 ms 2896 KB Output is correct
13 Correct 46 ms 2900 KB Output is correct
14 Correct 46 ms 2900 KB Output is correct
15 Correct 46 ms 2896 KB Output is correct
16 Correct 62 ms 2900 KB Output is correct
17 Correct 46 ms 2900 KB Output is correct
18 Correct 42 ms 2896 KB Output is correct
19 Correct 51 ms 3428 KB Output is correct
20 Correct 50 ms 3152 KB Output is correct
21 Correct 76 ms 3412 KB Output is correct
22 Correct 50 ms 3412 KB Output is correct
23 Correct 48 ms 3504 KB Output is correct
24 Correct 48 ms 3156 KB Output is correct
25 Correct 49 ms 3404 KB Output is correct
26 Correct 46 ms 3412 KB Output is correct
27 Correct 54 ms 3412 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 43 ms 2896 KB Output is correct
30 Correct 46 ms 2864 KB Output is correct
31 Correct 60 ms 2960 KB Output is correct
32 Correct 44 ms 2900 KB Output is correct
33 Correct 46 ms 2900 KB Output is correct
34 Correct 46 ms 2884 KB Output is correct
35 Correct 46 ms 2992 KB Output is correct
36 Correct 42 ms 2896 KB Output is correct
37 Correct 49 ms 3160 KB Output is correct
38 Correct 49 ms 3228 KB Output is correct
39 Correct 61 ms 3412 KB Output is correct
40 Correct 60 ms 3412 KB Output is correct
41 Correct 49 ms 3420 KB Output is correct
42 Correct 48 ms 3328 KB Output is correct
43 Correct 48 ms 3196 KB Output is correct
44 Correct 45 ms 3568 KB Output is correct
45 Correct 53 ms 3152 KB Output is correct
46 Correct 79 ms 3556 KB Output is correct
47 Correct 61 ms 3972 KB Output is correct
48 Correct 162 ms 3408 KB Output is correct
49 Correct 53 ms 3664 KB Output is correct
50 Correct 62 ms 3832 KB Output is correct
51 Correct 119 ms 3408 KB Output is correct
52 Correct 45 ms 3156 KB Output is correct
53 Correct 55 ms 3408 KB Output is correct
54 Correct 51 ms 3316 KB Output is correct
55 Correct 1283 ms 3848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 43 ms 2600 KB Output is correct
3 Correct 54 ms 2920 KB Output is correct
4 Correct 53 ms 2896 KB Output is correct
5 Correct 43 ms 2900 KB Output is correct
6 Correct 46 ms 2896 KB Output is correct
7 Correct 46 ms 2896 KB Output is correct
8 Correct 64 ms 2896 KB Output is correct
9 Correct 42 ms 3016 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 43 ms 2896 KB Output is correct
12 Correct 45 ms 2896 KB Output is correct
13 Correct 46 ms 2900 KB Output is correct
14 Correct 46 ms 2900 KB Output is correct
15 Correct 46 ms 2896 KB Output is correct
16 Correct 62 ms 2900 KB Output is correct
17 Correct 46 ms 2900 KB Output is correct
18 Correct 42 ms 2896 KB Output is correct
19 Correct 51 ms 3428 KB Output is correct
20 Correct 50 ms 3152 KB Output is correct
21 Correct 76 ms 3412 KB Output is correct
22 Correct 50 ms 3412 KB Output is correct
23 Correct 48 ms 3504 KB Output is correct
24 Correct 48 ms 3156 KB Output is correct
25 Correct 49 ms 3404 KB Output is correct
26 Correct 46 ms 3412 KB Output is correct
27 Correct 54 ms 3412 KB Output is correct
28 Correct 74 ms 7508 KB Output is correct
29 Correct 77 ms 7044 KB Output is correct
30 Correct 87 ms 7304 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 79 ms 7500 KB Output is correct
33 Correct 76 ms 7052 KB Output is correct
34 Correct 94 ms 7628 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 43 ms 3028 KB Output is correct
38 Correct 74 ms 2956 KB Output is correct
39 Correct 44 ms 2904 KB Output is correct
40 Correct 78 ms 2900 KB Output is correct
41 Correct 59 ms 3020 KB Output is correct
42 Correct 45 ms 2896 KB Output is correct
43 Correct 44 ms 2640 KB Output is correct
44 Correct 53 ms 2040 KB Output is correct
45 Correct 47 ms 2896 KB Output is correct
46 Correct 48 ms 2384 KB Output is correct
47 Correct 89 ms 2880 KB Output is correct
48 Correct 92 ms 2640 KB Output is correct
49 Correct 50 ms 2320 KB Output is correct
50 Correct 46 ms 1876 KB Output is correct
51 Correct 47 ms 1524 KB Output is correct
52 Correct 48 ms 1748 KB Output is correct
53 Correct 55 ms 2640 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 46 ms 2388 KB Output is correct
56 Correct 48 ms 2148 KB Output is correct
57 Correct 101 ms 3324 KB Output is correct
58 Correct 51 ms 3664 KB Output is correct
59 Correct 204 ms 2932 KB Output is correct
60 Correct 75 ms 4428 KB Output is correct
61 Correct 76 ms 2932 KB Output is correct
62 Correct 80 ms 4436 KB Output is correct
63 Correct 82 ms 6740 KB Output is correct
64 Correct 75 ms 3588 KB Output is correct
65 Correct 77 ms 5200 KB Output is correct
66 Correct 454 ms 1360 KB Output is correct
67 Correct 449 ms 2924 KB Output is correct
68 Correct 93 ms 5440 KB Output is correct
69 Correct 135 ms 5104 KB Output is correct
70 Correct 101 ms 4688 KB Output is correct
71 Correct 1448 ms 5620 KB Output is correct
72 Correct 151 ms 4180 KB Output is correct
73 Correct 1871 ms 4428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 43 ms 2600 KB Output is correct
3 Correct 54 ms 2920 KB Output is correct
4 Correct 53 ms 2896 KB Output is correct
5 Correct 43 ms 2900 KB Output is correct
6 Correct 46 ms 2896 KB Output is correct
7 Correct 46 ms 2896 KB Output is correct
8 Correct 64 ms 2896 KB Output is correct
9 Correct 42 ms 3016 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 49 ms 2788 KB Output is correct
12 Correct 50 ms 1872 KB Output is correct
13 Correct 62 ms 2796 KB Output is correct
14 Correct 74 ms 2948 KB Output is correct
15 Correct 46 ms 2620 KB Output is correct
16 Correct 78 ms 2792 KB Output is correct
17 Correct 50 ms 2204 KB Output is correct
18 Correct 56 ms 2640 KB Output is correct
19 Correct 125 ms 3760 KB Output is correct
20 Execution timed out 4005 ms 4436 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 43 ms 2600 KB Output is correct
3 Correct 54 ms 2920 KB Output is correct
4 Correct 53 ms 2896 KB Output is correct
5 Correct 43 ms 2900 KB Output is correct
6 Correct 46 ms 2896 KB Output is correct
7 Correct 46 ms 2896 KB Output is correct
8 Correct 64 ms 2896 KB Output is correct
9 Correct 42 ms 3016 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 43 ms 2896 KB Output is correct
12 Correct 45 ms 2896 KB Output is correct
13 Correct 46 ms 2900 KB Output is correct
14 Correct 46 ms 2900 KB Output is correct
15 Correct 46 ms 2896 KB Output is correct
16 Correct 62 ms 2900 KB Output is correct
17 Correct 46 ms 2900 KB Output is correct
18 Correct 42 ms 2896 KB Output is correct
19 Correct 51 ms 3428 KB Output is correct
20 Correct 50 ms 3152 KB Output is correct
21 Correct 76 ms 3412 KB Output is correct
22 Correct 50 ms 3412 KB Output is correct
23 Correct 48 ms 3504 KB Output is correct
24 Correct 48 ms 3156 KB Output is correct
25 Correct 49 ms 3404 KB Output is correct
26 Correct 46 ms 3412 KB Output is correct
27 Correct 54 ms 3412 KB Output is correct
28 Correct 74 ms 7508 KB Output is correct
29 Correct 77 ms 7044 KB Output is correct
30 Correct 87 ms 7304 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 43 ms 2896 KB Output is correct
34 Correct 46 ms 2864 KB Output is correct
35 Correct 60 ms 2960 KB Output is correct
36 Correct 44 ms 2900 KB Output is correct
37 Correct 46 ms 2900 KB Output is correct
38 Correct 46 ms 2884 KB Output is correct
39 Correct 46 ms 2992 KB Output is correct
40 Correct 42 ms 2896 KB Output is correct
41 Correct 49 ms 3160 KB Output is correct
42 Correct 49 ms 3228 KB Output is correct
43 Correct 61 ms 3412 KB Output is correct
44 Correct 60 ms 3412 KB Output is correct
45 Correct 49 ms 3420 KB Output is correct
46 Correct 48 ms 3328 KB Output is correct
47 Correct 48 ms 3196 KB Output is correct
48 Correct 45 ms 3568 KB Output is correct
49 Correct 53 ms 3152 KB Output is correct
50 Correct 79 ms 3556 KB Output is correct
51 Correct 61 ms 3972 KB Output is correct
52 Correct 162 ms 3408 KB Output is correct
53 Correct 53 ms 3664 KB Output is correct
54 Correct 62 ms 3832 KB Output is correct
55 Correct 119 ms 3408 KB Output is correct
56 Correct 45 ms 3156 KB Output is correct
57 Correct 55 ms 3408 KB Output is correct
58 Correct 51 ms 3316 KB Output is correct
59 Correct 1283 ms 3848 KB Output is correct
60 Correct 79 ms 7500 KB Output is correct
61 Correct 76 ms 7052 KB Output is correct
62 Correct 94 ms 7628 KB Output is correct
63 Correct 0 ms 344 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 43 ms 3028 KB Output is correct
66 Correct 74 ms 2956 KB Output is correct
67 Correct 44 ms 2904 KB Output is correct
68 Correct 78 ms 2900 KB Output is correct
69 Correct 59 ms 3020 KB Output is correct
70 Correct 45 ms 2896 KB Output is correct
71 Correct 44 ms 2640 KB Output is correct
72 Correct 53 ms 2040 KB Output is correct
73 Correct 47 ms 2896 KB Output is correct
74 Correct 48 ms 2384 KB Output is correct
75 Correct 89 ms 2880 KB Output is correct
76 Correct 92 ms 2640 KB Output is correct
77 Correct 50 ms 2320 KB Output is correct
78 Correct 46 ms 1876 KB Output is correct
79 Correct 47 ms 1524 KB Output is correct
80 Correct 48 ms 1748 KB Output is correct
81 Correct 55 ms 2640 KB Output is correct
82 Correct 0 ms 344 KB Output is correct
83 Correct 46 ms 2388 KB Output is correct
84 Correct 48 ms 2148 KB Output is correct
85 Correct 101 ms 3324 KB Output is correct
86 Correct 51 ms 3664 KB Output is correct
87 Correct 204 ms 2932 KB Output is correct
88 Correct 75 ms 4428 KB Output is correct
89 Correct 76 ms 2932 KB Output is correct
90 Correct 80 ms 4436 KB Output is correct
91 Correct 82 ms 6740 KB Output is correct
92 Correct 75 ms 3588 KB Output is correct
93 Correct 77 ms 5200 KB Output is correct
94 Correct 454 ms 1360 KB Output is correct
95 Correct 449 ms 2924 KB Output is correct
96 Correct 93 ms 5440 KB Output is correct
97 Correct 135 ms 5104 KB Output is correct
98 Correct 101 ms 4688 KB Output is correct
99 Correct 1448 ms 5620 KB Output is correct
100 Correct 151 ms 4180 KB Output is correct
101 Correct 1871 ms 4428 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 49 ms 2788 KB Output is correct
104 Correct 50 ms 1872 KB Output is correct
105 Correct 62 ms 2796 KB Output is correct
106 Correct 74 ms 2948 KB Output is correct
107 Correct 46 ms 2620 KB Output is correct
108 Correct 78 ms 2792 KB Output is correct
109 Correct 50 ms 2204 KB Output is correct
110 Correct 56 ms 2640 KB Output is correct
111 Correct 125 ms 3760 KB Output is correct
112 Execution timed out 4005 ms 4436 KB Time limit exceeded
113 Halted 0 ms 0 KB -