답안 #1049441

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1049441 2024-08-08T18:33:45 Z rainboy Bring Down the Grading Server (CEOI23_gradingserver) C
85 / 100
4000 ms 16464 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(x2, y2, x1 + c, y1 - 1);
}
 
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 344 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 46 ms 1168 KB Output is correct
3 Correct 44 ms 1108 KB Output is correct
4 Correct 45 ms 1192 KB Output is correct
5 Correct 43 ms 1104 KB Output is correct
6 Correct 44 ms 1104 KB Output is correct
7 Correct 51 ms 1360 KB Output is correct
8 Correct 48 ms 1108 KB Output is correct
9 Correct 41 ms 1248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 46 ms 1168 KB Output is correct
3 Correct 44 ms 1108 KB Output is correct
4 Correct 45 ms 1192 KB Output is correct
5 Correct 43 ms 1104 KB Output is correct
6 Correct 44 ms 1104 KB Output is correct
7 Correct 51 ms 1360 KB Output is correct
8 Correct 48 ms 1108 KB Output is correct
9 Correct 41 ms 1248 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 54 ms 1052 KB Output is correct
12 Correct 50 ms 1360 KB Output is correct
13 Correct 43 ms 1104 KB Output is correct
14 Correct 42 ms 1108 KB Output is correct
15 Correct 45 ms 1108 KB Output is correct
16 Correct 50 ms 1108 KB Output is correct
17 Correct 47 ms 1200 KB Output is correct
18 Correct 47 ms 1108 KB Output is correct
19 Correct 47 ms 1104 KB Output is correct
20 Correct 51 ms 1108 KB Output is correct
21 Correct 64 ms 1048 KB Output is correct
22 Correct 47 ms 1052 KB Output is correct
23 Correct 47 ms 1076 KB Output is correct
24 Correct 46 ms 1108 KB Output is correct
25 Correct 48 ms 1108 KB Output is correct
26 Correct 48 ms 1072 KB Output is correct
27 Correct 45 ms 1196 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 1108 KB Output is correct
2 Correct 70 ms 1108 KB Output is correct
3 Correct 74 ms 1064 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 46 ms 1168 KB Output is correct
3 Correct 44 ms 1108 KB Output is correct
4 Correct 45 ms 1192 KB Output is correct
5 Correct 43 ms 1104 KB Output is correct
6 Correct 44 ms 1104 KB Output is correct
7 Correct 51 ms 1360 KB Output is correct
8 Correct 48 ms 1108 KB Output is correct
9 Correct 41 ms 1248 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 54 ms 1052 KB Output is correct
12 Correct 50 ms 1360 KB Output is correct
13 Correct 43 ms 1104 KB Output is correct
14 Correct 42 ms 1108 KB Output is correct
15 Correct 45 ms 1108 KB Output is correct
16 Correct 50 ms 1108 KB Output is correct
17 Correct 47 ms 1200 KB Output is correct
18 Correct 47 ms 1108 KB Output is correct
19 Correct 47 ms 1104 KB Output is correct
20 Correct 51 ms 1108 KB Output is correct
21 Correct 64 ms 1048 KB Output is correct
22 Correct 47 ms 1052 KB Output is correct
23 Correct 47 ms 1076 KB Output is correct
24 Correct 46 ms 1108 KB Output is correct
25 Correct 48 ms 1108 KB Output is correct
26 Correct 48 ms 1072 KB Output is correct
27 Correct 45 ms 1196 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 42 ms 1268 KB Output is correct
30 Correct 51 ms 1272 KB Output is correct
31 Correct 44 ms 1104 KB Output is correct
32 Correct 42 ms 1152 KB Output is correct
33 Correct 45 ms 1104 KB Output is correct
34 Correct 57 ms 1104 KB Output is correct
35 Correct 49 ms 1088 KB Output is correct
36 Correct 41 ms 1104 KB Output is correct
37 Correct 49 ms 1100 KB Output is correct
38 Correct 50 ms 1240 KB Output is correct
39 Correct 56 ms 1108 KB Output is correct
40 Correct 64 ms 1160 KB Output is correct
41 Correct 46 ms 1256 KB Output is correct
42 Correct 52 ms 1108 KB Output is correct
43 Correct 63 ms 1056 KB Output is correct
44 Correct 45 ms 1112 KB Output is correct
45 Correct 49 ms 1116 KB Output is correct
46 Correct 102 ms 1052 KB Output is correct
47 Correct 57 ms 1104 KB Output is correct
48 Correct 111 ms 1108 KB Output is correct
49 Correct 52 ms 1108 KB Output is correct
50 Correct 53 ms 1252 KB Output is correct
51 Correct 69 ms 1140 KB Output is correct
52 Correct 45 ms 1116 KB Output is correct
53 Correct 46 ms 1176 KB Output is correct
54 Correct 45 ms 1284 KB Output is correct
55 Correct 281 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 46 ms 1168 KB Output is correct
3 Correct 44 ms 1108 KB Output is correct
4 Correct 45 ms 1192 KB Output is correct
5 Correct 43 ms 1104 KB Output is correct
6 Correct 44 ms 1104 KB Output is correct
7 Correct 51 ms 1360 KB Output is correct
8 Correct 48 ms 1108 KB Output is correct
9 Correct 41 ms 1248 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 54 ms 1052 KB Output is correct
12 Correct 50 ms 1360 KB Output is correct
13 Correct 43 ms 1104 KB Output is correct
14 Correct 42 ms 1108 KB Output is correct
15 Correct 45 ms 1108 KB Output is correct
16 Correct 50 ms 1108 KB Output is correct
17 Correct 47 ms 1200 KB Output is correct
18 Correct 47 ms 1108 KB Output is correct
19 Correct 47 ms 1104 KB Output is correct
20 Correct 51 ms 1108 KB Output is correct
21 Correct 64 ms 1048 KB Output is correct
22 Correct 47 ms 1052 KB Output is correct
23 Correct 47 ms 1076 KB Output is correct
24 Correct 46 ms 1108 KB Output is correct
25 Correct 48 ms 1108 KB Output is correct
26 Correct 48 ms 1072 KB Output is correct
27 Correct 45 ms 1196 KB Output is correct
28 Correct 70 ms 1108 KB Output is correct
29 Correct 70 ms 1108 KB Output is correct
30 Correct 74 ms 1064 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 70 ms 1108 KB Output is correct
33 Correct 71 ms 1272 KB Output is correct
34 Correct 74 ms 1192 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 44 ms 1036 KB Output is correct
38 Correct 42 ms 1272 KB Output is correct
39 Correct 44 ms 1252 KB Output is correct
40 Correct 43 ms 1108 KB Output is correct
41 Correct 53 ms 1104 KB Output is correct
42 Correct 58 ms 1104 KB Output is correct
43 Correct 57 ms 1108 KB Output is correct
44 Correct 41 ms 1108 KB Output is correct
45 Correct 46 ms 1268 KB Output is correct
46 Correct 47 ms 1108 KB Output is correct
47 Correct 57 ms 1104 KB Output is correct
48 Correct 47 ms 1212 KB Output is correct
49 Correct 50 ms 1156 KB Output is correct
50 Correct 46 ms 1240 KB Output is correct
51 Correct 50 ms 1160 KB Output is correct
52 Correct 44 ms 1112 KB Output is correct
53 Correct 45 ms 1112 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 44 ms 1160 KB Output is correct
56 Correct 45 ms 1104 KB Output is correct
57 Correct 72 ms 1104 KB Output is correct
58 Correct 49 ms 1108 KB Output is correct
59 Correct 95 ms 1104 KB Output is correct
60 Correct 73 ms 5716 KB Output is correct
61 Correct 73 ms 3920 KB Output is correct
62 Correct 82 ms 7272 KB Output is correct
63 Correct 76 ms 11604 KB Output is correct
64 Correct 73 ms 5972 KB Output is correct
65 Correct 75 ms 8968 KB Output is correct
66 Correct 309 ms 1620 KB Output is correct
67 Correct 311 ms 3924 KB Output is correct
68 Correct 72 ms 9556 KB Output is correct
69 Correct 83 ms 8468 KB Output is correct
70 Correct 106 ms 7764 KB Output is correct
71 Correct 1466 ms 9512 KB Output is correct
72 Correct 112 ms 6852 KB Output is correct
73 Correct 1085 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 46 ms 1168 KB Output is correct
3 Correct 44 ms 1108 KB Output is correct
4 Correct 45 ms 1192 KB Output is correct
5 Correct 43 ms 1104 KB Output is correct
6 Correct 44 ms 1104 KB Output is correct
7 Correct 51 ms 1360 KB Output is correct
8 Correct 48 ms 1108 KB Output is correct
9 Correct 41 ms 1248 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 42 ms 1212 KB Output is correct
12 Correct 51 ms 1084 KB Output is correct
13 Correct 62 ms 1232 KB Output is correct
14 Correct 42 ms 1108 KB Output is correct
15 Correct 45 ms 1100 KB Output is correct
16 Correct 44 ms 1176 KB Output is correct
17 Correct 44 ms 1140 KB Output is correct
18 Correct 42 ms 1104 KB Output is correct
19 Correct 64 ms 1176 KB Output is correct
20 Correct 717 ms 4956 KB Output is correct
21 Correct 1101 ms 6996 KB Output is correct
22 Correct 1419 ms 6996 KB Output is correct
23 Correct 416 ms 9036 KB Output is correct
24 Correct 453 ms 9040 KB Output is correct
25 Correct 174 ms 8272 KB Output is correct
26 Correct 82 ms 9044 KB Output is correct
27 Correct 1054 ms 7556 KB Output is correct
28 Correct 2005 ms 8628 KB Output is correct
29 Correct 839 ms 6204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 46 ms 1168 KB Output is correct
3 Correct 44 ms 1108 KB Output is correct
4 Correct 45 ms 1192 KB Output is correct
5 Correct 43 ms 1104 KB Output is correct
6 Correct 44 ms 1104 KB Output is correct
7 Correct 51 ms 1360 KB Output is correct
8 Correct 48 ms 1108 KB Output is correct
9 Correct 41 ms 1248 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 54 ms 1052 KB Output is correct
12 Correct 50 ms 1360 KB Output is correct
13 Correct 43 ms 1104 KB Output is correct
14 Correct 42 ms 1108 KB Output is correct
15 Correct 45 ms 1108 KB Output is correct
16 Correct 50 ms 1108 KB Output is correct
17 Correct 47 ms 1200 KB Output is correct
18 Correct 47 ms 1108 KB Output is correct
19 Correct 47 ms 1104 KB Output is correct
20 Correct 51 ms 1108 KB Output is correct
21 Correct 64 ms 1048 KB Output is correct
22 Correct 47 ms 1052 KB Output is correct
23 Correct 47 ms 1076 KB Output is correct
24 Correct 46 ms 1108 KB Output is correct
25 Correct 48 ms 1108 KB Output is correct
26 Correct 48 ms 1072 KB Output is correct
27 Correct 45 ms 1196 KB Output is correct
28 Correct 70 ms 1108 KB Output is correct
29 Correct 70 ms 1108 KB Output is correct
30 Correct 74 ms 1064 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 42 ms 1268 KB Output is correct
34 Correct 51 ms 1272 KB Output is correct
35 Correct 44 ms 1104 KB Output is correct
36 Correct 42 ms 1152 KB Output is correct
37 Correct 45 ms 1104 KB Output is correct
38 Correct 57 ms 1104 KB Output is correct
39 Correct 49 ms 1088 KB Output is correct
40 Correct 41 ms 1104 KB Output is correct
41 Correct 49 ms 1100 KB Output is correct
42 Correct 50 ms 1240 KB Output is correct
43 Correct 56 ms 1108 KB Output is correct
44 Correct 64 ms 1160 KB Output is correct
45 Correct 46 ms 1256 KB Output is correct
46 Correct 52 ms 1108 KB Output is correct
47 Correct 63 ms 1056 KB Output is correct
48 Correct 45 ms 1112 KB Output is correct
49 Correct 49 ms 1116 KB Output is correct
50 Correct 102 ms 1052 KB Output is correct
51 Correct 57 ms 1104 KB Output is correct
52 Correct 111 ms 1108 KB Output is correct
53 Correct 52 ms 1108 KB Output is correct
54 Correct 53 ms 1252 KB Output is correct
55 Correct 69 ms 1140 KB Output is correct
56 Correct 45 ms 1116 KB Output is correct
57 Correct 46 ms 1176 KB Output is correct
58 Correct 45 ms 1284 KB Output is correct
59 Correct 281 ms 1104 KB Output is correct
60 Correct 70 ms 1108 KB Output is correct
61 Correct 71 ms 1272 KB Output is correct
62 Correct 74 ms 1192 KB Output is correct
63 Correct 0 ms 344 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 44 ms 1036 KB Output is correct
66 Correct 42 ms 1272 KB Output is correct
67 Correct 44 ms 1252 KB Output is correct
68 Correct 43 ms 1108 KB Output is correct
69 Correct 53 ms 1104 KB Output is correct
70 Correct 58 ms 1104 KB Output is correct
71 Correct 57 ms 1108 KB Output is correct
72 Correct 41 ms 1108 KB Output is correct
73 Correct 46 ms 1268 KB Output is correct
74 Correct 47 ms 1108 KB Output is correct
75 Correct 57 ms 1104 KB Output is correct
76 Correct 47 ms 1212 KB Output is correct
77 Correct 50 ms 1156 KB Output is correct
78 Correct 46 ms 1240 KB Output is correct
79 Correct 50 ms 1160 KB Output is correct
80 Correct 44 ms 1112 KB Output is correct
81 Correct 45 ms 1112 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 44 ms 1160 KB Output is correct
84 Correct 45 ms 1104 KB Output is correct
85 Correct 72 ms 1104 KB Output is correct
86 Correct 49 ms 1108 KB Output is correct
87 Correct 95 ms 1104 KB Output is correct
88 Correct 73 ms 5716 KB Output is correct
89 Correct 73 ms 3920 KB Output is correct
90 Correct 82 ms 7272 KB Output is correct
91 Correct 76 ms 11604 KB Output is correct
92 Correct 73 ms 5972 KB Output is correct
93 Correct 75 ms 8968 KB Output is correct
94 Correct 309 ms 1620 KB Output is correct
95 Correct 311 ms 3924 KB Output is correct
96 Correct 72 ms 9556 KB Output is correct
97 Correct 83 ms 8468 KB Output is correct
98 Correct 106 ms 7764 KB Output is correct
99 Correct 1466 ms 9512 KB Output is correct
100 Correct 112 ms 6852 KB Output is correct
101 Correct 1085 ms 7248 KB Output is correct
102 Correct 0 ms 344 KB Output is correct
103 Correct 42 ms 1212 KB Output is correct
104 Correct 51 ms 1084 KB Output is correct
105 Correct 62 ms 1232 KB Output is correct
106 Correct 42 ms 1108 KB Output is correct
107 Correct 45 ms 1100 KB Output is correct
108 Correct 44 ms 1176 KB Output is correct
109 Correct 44 ms 1140 KB Output is correct
110 Correct 42 ms 1104 KB Output is correct
111 Correct 64 ms 1176 KB Output is correct
112 Correct 717 ms 4956 KB Output is correct
113 Correct 1101 ms 6996 KB Output is correct
114 Correct 1419 ms 6996 KB Output is correct
115 Correct 416 ms 9036 KB Output is correct
116 Correct 453 ms 9040 KB Output is correct
117 Correct 174 ms 8272 KB Output is correct
118 Correct 82 ms 9044 KB Output is correct
119 Correct 1054 ms 7556 KB Output is correct
120 Correct 2005 ms 8628 KB Output is correct
121 Correct 839 ms 6204 KB Output is correct
122 Correct 74 ms 12776 KB Output is correct
123 Correct 72 ms 12544 KB Output is correct
124 Correct 74 ms 13648 KB Output is correct
125 Correct 0 ms 344 KB Output is correct
126 Correct 0 ms 348 KB Output is correct
127 Correct 42 ms 4044 KB Output is correct
128 Correct 58 ms 3920 KB Output is correct
129 Correct 52 ms 3920 KB Output is correct
130 Correct 43 ms 3924 KB Output is correct
131 Correct 45 ms 3924 KB Output is correct
132 Correct 45 ms 3864 KB Output is correct
133 Correct 57 ms 3796 KB Output is correct
134 Correct 43 ms 3920 KB Output is correct
135 Correct 48 ms 4588 KB Output is correct
136 Correct 49 ms 4436 KB Output is correct
137 Correct 57 ms 4752 KB Output is correct
138 Correct 48 ms 4692 KB Output is correct
139 Correct 47 ms 4688 KB Output is correct
140 Correct 51 ms 4356 KB Output is correct
141 Correct 49 ms 4508 KB Output is correct
142 Correct 46 ms 4688 KB Output is correct
143 Correct 45 ms 4432 KB Output is correct
144 Correct 0 ms 348 KB Output is correct
145 Correct 44 ms 4888 KB Output is correct
146 Correct 47 ms 4432 KB Output is correct
147 Correct 68 ms 5232 KB Output is correct
148 Correct 54 ms 5668 KB Output is correct
149 Correct 98 ms 5380 KB Output is correct
150 Correct 82 ms 12884 KB Output is correct
151 Correct 75 ms 13060 KB Output is correct
152 Correct 84 ms 12884 KB Output is correct
153 Correct 74 ms 13236 KB Output is correct
154 Correct 79 ms 12628 KB Output is correct
155 Correct 75 ms 13140 KB Output is correct
156 Correct 308 ms 5408 KB Output is correct
157 Correct 302 ms 5408 KB Output is correct
158 Correct 73 ms 13736 KB Output is correct
159 Correct 85 ms 12624 KB Output is correct
160 Correct 101 ms 9296 KB Output is correct
161 Correct 1494 ms 10064 KB Output is correct
162 Correct 111 ms 12368 KB Output is correct
163 Correct 1079 ms 8228 KB Output is correct
164 Correct 55 ms 5456 KB Output is correct
165 Correct 54 ms 5712 KB Output is correct
166 Correct 81 ms 5364 KB Output is correct
167 Correct 45 ms 4432 KB Output is correct
168 Correct 285 ms 5752 KB Output is correct
169 Correct 70 ms 5972 KB Output is correct
170 Correct 697 ms 6992 KB Output is correct
171 Correct 1096 ms 6884 KB Output is correct
172 Correct 1407 ms 7128 KB Output is correct
173 Correct 423 ms 9040 KB Output is correct
174 Correct 466 ms 8956 KB Output is correct
175 Correct 174 ms 9044 KB Output is correct
176 Correct 78 ms 9040 KB Output is correct
177 Correct 1094 ms 8532 KB Output is correct
178 Correct 2000 ms 8652 KB Output is correct
179 Correct 864 ms 8348 KB Output is correct
180 Correct 89 ms 12884 KB Output is correct
181 Correct 75 ms 13392 KB Output is correct
182 Correct 106 ms 15956 KB Output is correct
183 Correct 100 ms 16464 KB Output is correct
184 Correct 80 ms 13908 KB Output is correct
185 Execution timed out 4070 ms 4688 KB Time limit exceeded
186 Halted 0 ms 0 KB -