답안 #1056438

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056438 2024-08-13T09:26:23 Z rainboy Bring Down the Grading Server (CEOI23_gradingserver) C
85 / 100
4000 ms 13764 KB
#include <stdio.h>
 
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(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)
		return 0;
	y = y2 == 0 ? 1 : max(min((x2 + c * (y2 - 1)) / (y2 + 1), x2) - x1, 0) / (c - x2) + 1;
	return y <= y1 && solve(x1 + y * (c - x2), y1 - y, 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:46:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |  scanf("%d%d", &c, &t);
      |  ^~~~~~~~~~~~~~~~~~~~~
gradingserver.c:50:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |   scanf("%lld%lld%lld%lld", &x1, &y2, &x2, &y1), x1 -= y1 * c, x2 -= y2 * c;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 420 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 344 KB Output is correct
2 Correct 51 ms 4052 KB Output is correct
3 Correct 43 ms 3880 KB Output is correct
4 Correct 49 ms 4056 KB Output is correct
5 Correct 52 ms 3920 KB Output is correct
6 Correct 45 ms 3920 KB Output is correct
7 Correct 46 ms 3924 KB Output is correct
8 Correct 44 ms 3920 KB Output is correct
9 Correct 42 ms 3896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 51 ms 4052 KB Output is correct
3 Correct 43 ms 3880 KB Output is correct
4 Correct 49 ms 4056 KB Output is correct
5 Correct 52 ms 3920 KB Output is correct
6 Correct 45 ms 3920 KB Output is correct
7 Correct 46 ms 3924 KB Output is correct
8 Correct 44 ms 3920 KB Output is correct
9 Correct 42 ms 3896 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 42 ms 4032 KB Output is correct
12 Correct 51 ms 3884 KB Output is correct
13 Correct 44 ms 4012 KB Output is correct
14 Correct 85 ms 3924 KB Output is correct
15 Correct 46 ms 3928 KB Output is correct
16 Correct 45 ms 3800 KB Output is correct
17 Correct 50 ms 3924 KB Output is correct
18 Correct 41 ms 3920 KB Output is correct
19 Correct 48 ms 4596 KB Output is correct
20 Correct 48 ms 4432 KB Output is correct
21 Correct 59 ms 4692 KB Output is correct
22 Correct 48 ms 4692 KB Output is correct
23 Correct 47 ms 4680 KB Output is correct
24 Correct 46 ms 4432 KB Output is correct
25 Correct 48 ms 4432 KB Output is correct
26 Correct 45 ms 4692 KB Output is correct
27 Correct 45 ms 4432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 12564 KB Output is correct
2 Correct 88 ms 11856 KB Output is correct
3 Correct 78 ms 12064 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 51 ms 4052 KB Output is correct
3 Correct 43 ms 3880 KB Output is correct
4 Correct 49 ms 4056 KB Output is correct
5 Correct 52 ms 3920 KB Output is correct
6 Correct 45 ms 3920 KB Output is correct
7 Correct 46 ms 3924 KB Output is correct
8 Correct 44 ms 3920 KB Output is correct
9 Correct 42 ms 3896 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 42 ms 4032 KB Output is correct
12 Correct 51 ms 3884 KB Output is correct
13 Correct 44 ms 4012 KB Output is correct
14 Correct 85 ms 3924 KB Output is correct
15 Correct 46 ms 3928 KB Output is correct
16 Correct 45 ms 3800 KB Output is correct
17 Correct 50 ms 3924 KB Output is correct
18 Correct 41 ms 3920 KB Output is correct
19 Correct 48 ms 4596 KB Output is correct
20 Correct 48 ms 4432 KB Output is correct
21 Correct 59 ms 4692 KB Output is correct
22 Correct 48 ms 4692 KB Output is correct
23 Correct 47 ms 4680 KB Output is correct
24 Correct 46 ms 4432 KB Output is correct
25 Correct 48 ms 4432 KB Output is correct
26 Correct 45 ms 4692 KB Output is correct
27 Correct 45 ms 4432 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 43 ms 4036 KB Output is correct
30 Correct 43 ms 3920 KB Output is correct
31 Correct 48 ms 3924 KB Output is correct
32 Correct 59 ms 3920 KB Output is correct
33 Correct 79 ms 3920 KB Output is correct
34 Correct 48 ms 3952 KB Output is correct
35 Correct 48 ms 3804 KB Output is correct
36 Correct 41 ms 4040 KB Output is correct
37 Correct 49 ms 4692 KB Output is correct
38 Correct 89 ms 4524 KB Output is correct
39 Correct 57 ms 4796 KB Output is correct
40 Correct 50 ms 4688 KB Output is correct
41 Correct 53 ms 4688 KB Output is correct
42 Correct 50 ms 4304 KB Output is correct
43 Correct 48 ms 4432 KB Output is correct
44 Correct 45 ms 4604 KB Output is correct
45 Correct 51 ms 4436 KB Output is correct
46 Correct 70 ms 5324 KB Output is correct
47 Correct 51 ms 5712 KB Output is correct
48 Correct 80 ms 5200 KB Output is correct
49 Correct 54 ms 5460 KB Output is correct
50 Correct 61 ms 5716 KB Output is correct
51 Correct 65 ms 5452 KB Output is correct
52 Correct 46 ms 4432 KB Output is correct
53 Correct 44 ms 4692 KB Output is correct
54 Correct 45 ms 4432 KB Output is correct
55 Correct 146 ms 5864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 51 ms 4052 KB Output is correct
3 Correct 43 ms 3880 KB Output is correct
4 Correct 49 ms 4056 KB Output is correct
5 Correct 52 ms 3920 KB Output is correct
6 Correct 45 ms 3920 KB Output is correct
7 Correct 46 ms 3924 KB Output is correct
8 Correct 44 ms 3920 KB Output is correct
9 Correct 42 ms 3896 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 42 ms 4032 KB Output is correct
12 Correct 51 ms 3884 KB Output is correct
13 Correct 44 ms 4012 KB Output is correct
14 Correct 85 ms 3924 KB Output is correct
15 Correct 46 ms 3928 KB Output is correct
16 Correct 45 ms 3800 KB Output is correct
17 Correct 50 ms 3924 KB Output is correct
18 Correct 41 ms 3920 KB Output is correct
19 Correct 48 ms 4596 KB Output is correct
20 Correct 48 ms 4432 KB Output is correct
21 Correct 59 ms 4692 KB Output is correct
22 Correct 48 ms 4692 KB Output is correct
23 Correct 47 ms 4680 KB Output is correct
24 Correct 46 ms 4432 KB Output is correct
25 Correct 48 ms 4432 KB Output is correct
26 Correct 45 ms 4692 KB Output is correct
27 Correct 45 ms 4432 KB Output is correct
28 Correct 91 ms 12564 KB Output is correct
29 Correct 88 ms 11856 KB Output is correct
30 Correct 78 ms 12064 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 73 ms 13648 KB Output is correct
33 Correct 80 ms 12724 KB Output is correct
34 Correct 77 ms 13552 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 42 ms 4068 KB Output is correct
38 Correct 44 ms 3920 KB Output is correct
39 Correct 45 ms 3920 KB Output is correct
40 Correct 46 ms 3888 KB Output is correct
41 Correct 45 ms 3920 KB Output is correct
42 Correct 46 ms 3920 KB Output is correct
43 Correct 45 ms 4176 KB Output is correct
44 Correct 47 ms 3944 KB Output is correct
45 Correct 54 ms 4540 KB Output is correct
46 Correct 59 ms 4304 KB Output is correct
47 Correct 70 ms 4692 KB Output is correct
48 Correct 50 ms 4768 KB Output is correct
49 Correct 47 ms 4612 KB Output is correct
50 Correct 46 ms 4436 KB Output is correct
51 Correct 48 ms 4476 KB Output is correct
52 Correct 45 ms 4696 KB Output is correct
53 Correct 45 ms 4436 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 43 ms 4720 KB Output is correct
56 Correct 55 ms 4436 KB Output is correct
57 Correct 67 ms 5456 KB Output is correct
58 Correct 50 ms 5712 KB Output is correct
59 Correct 84 ms 5200 KB Output is correct
60 Correct 74 ms 12884 KB Output is correct
61 Correct 74 ms 13080 KB Output is correct
62 Correct 75 ms 13032 KB Output is correct
63 Correct 73 ms 13140 KB Output is correct
64 Correct 74 ms 12628 KB Output is correct
65 Correct 75 ms 13268 KB Output is correct
66 Correct 115 ms 5456 KB Output is correct
67 Correct 116 ms 5460 KB Output is correct
68 Correct 71 ms 13764 KB Output is correct
69 Correct 80 ms 12460 KB Output is correct
70 Correct 100 ms 9296 KB Output is correct
71 Correct 109 ms 10140 KB Output is correct
72 Correct 98 ms 12368 KB Output is correct
73 Correct 414 ms 8272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 51 ms 4052 KB Output is correct
3 Correct 43 ms 3880 KB Output is correct
4 Correct 49 ms 4056 KB Output is correct
5 Correct 52 ms 3920 KB Output is correct
6 Correct 45 ms 3920 KB Output is correct
7 Correct 46 ms 3924 KB Output is correct
8 Correct 44 ms 3920 KB Output is correct
9 Correct 42 ms 3896 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 43 ms 3984 KB Output is correct
12 Correct 43 ms 3920 KB Output is correct
13 Correct 44 ms 3924 KB Output is correct
14 Correct 43 ms 3920 KB Output is correct
15 Correct 46 ms 3924 KB Output is correct
16 Correct 45 ms 3920 KB Output is correct
17 Correct 44 ms 4176 KB Output is correct
18 Correct 41 ms 3952 KB Output is correct
19 Correct 60 ms 5972 KB Output is correct
20 Correct 287 ms 6992 KB Output is correct
21 Correct 492 ms 6740 KB Output is correct
22 Correct 524 ms 6996 KB Output is correct
23 Correct 190 ms 9008 KB Output is correct
24 Correct 226 ms 9080 KB Output is correct
25 Correct 119 ms 9040 KB Output is correct
26 Correct 87 ms 9040 KB Output is correct
27 Correct 790 ms 8484 KB Output is correct
28 Correct 1419 ms 8728 KB Output is correct
29 Correct 224 ms 8224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 51 ms 4052 KB Output is correct
3 Correct 43 ms 3880 KB Output is correct
4 Correct 49 ms 4056 KB Output is correct
5 Correct 52 ms 3920 KB Output is correct
6 Correct 45 ms 3920 KB Output is correct
7 Correct 46 ms 3924 KB Output is correct
8 Correct 44 ms 3920 KB Output is correct
9 Correct 42 ms 3896 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 42 ms 4032 KB Output is correct
12 Correct 51 ms 3884 KB Output is correct
13 Correct 44 ms 4012 KB Output is correct
14 Correct 85 ms 3924 KB Output is correct
15 Correct 46 ms 3928 KB Output is correct
16 Correct 45 ms 3800 KB Output is correct
17 Correct 50 ms 3924 KB Output is correct
18 Correct 41 ms 3920 KB Output is correct
19 Correct 48 ms 4596 KB Output is correct
20 Correct 48 ms 4432 KB Output is correct
21 Correct 59 ms 4692 KB Output is correct
22 Correct 48 ms 4692 KB Output is correct
23 Correct 47 ms 4680 KB Output is correct
24 Correct 46 ms 4432 KB Output is correct
25 Correct 48 ms 4432 KB Output is correct
26 Correct 45 ms 4692 KB Output is correct
27 Correct 45 ms 4432 KB Output is correct
28 Correct 91 ms 12564 KB Output is correct
29 Correct 88 ms 11856 KB Output is correct
30 Correct 78 ms 12064 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 43 ms 4036 KB Output is correct
34 Correct 43 ms 3920 KB Output is correct
35 Correct 48 ms 3924 KB Output is correct
36 Correct 59 ms 3920 KB Output is correct
37 Correct 79 ms 3920 KB Output is correct
38 Correct 48 ms 3952 KB Output is correct
39 Correct 48 ms 3804 KB Output is correct
40 Correct 41 ms 4040 KB Output is correct
41 Correct 49 ms 4692 KB Output is correct
42 Correct 89 ms 4524 KB Output is correct
43 Correct 57 ms 4796 KB Output is correct
44 Correct 50 ms 4688 KB Output is correct
45 Correct 53 ms 4688 KB Output is correct
46 Correct 50 ms 4304 KB Output is correct
47 Correct 48 ms 4432 KB Output is correct
48 Correct 45 ms 4604 KB Output is correct
49 Correct 51 ms 4436 KB Output is correct
50 Correct 70 ms 5324 KB Output is correct
51 Correct 51 ms 5712 KB Output is correct
52 Correct 80 ms 5200 KB Output is correct
53 Correct 54 ms 5460 KB Output is correct
54 Correct 61 ms 5716 KB Output is correct
55 Correct 65 ms 5452 KB Output is correct
56 Correct 46 ms 4432 KB Output is correct
57 Correct 44 ms 4692 KB Output is correct
58 Correct 45 ms 4432 KB Output is correct
59 Correct 146 ms 5864 KB Output is correct
60 Correct 73 ms 13648 KB Output is correct
61 Correct 80 ms 12724 KB Output is correct
62 Correct 77 ms 13552 KB Output is correct
63 Correct 0 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 42 ms 4068 KB Output is correct
66 Correct 44 ms 3920 KB Output is correct
67 Correct 45 ms 3920 KB Output is correct
68 Correct 46 ms 3888 KB Output is correct
69 Correct 45 ms 3920 KB Output is correct
70 Correct 46 ms 3920 KB Output is correct
71 Correct 45 ms 4176 KB Output is correct
72 Correct 47 ms 3944 KB Output is correct
73 Correct 54 ms 4540 KB Output is correct
74 Correct 59 ms 4304 KB Output is correct
75 Correct 70 ms 4692 KB Output is correct
76 Correct 50 ms 4768 KB Output is correct
77 Correct 47 ms 4612 KB Output is correct
78 Correct 46 ms 4436 KB Output is correct
79 Correct 48 ms 4476 KB Output is correct
80 Correct 45 ms 4696 KB Output is correct
81 Correct 45 ms 4436 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 43 ms 4720 KB Output is correct
84 Correct 55 ms 4436 KB Output is correct
85 Correct 67 ms 5456 KB Output is correct
86 Correct 50 ms 5712 KB Output is correct
87 Correct 84 ms 5200 KB Output is correct
88 Correct 74 ms 12884 KB Output is correct
89 Correct 74 ms 13080 KB Output is correct
90 Correct 75 ms 13032 KB Output is correct
91 Correct 73 ms 13140 KB Output is correct
92 Correct 74 ms 12628 KB Output is correct
93 Correct 75 ms 13268 KB Output is correct
94 Correct 115 ms 5456 KB Output is correct
95 Correct 116 ms 5460 KB Output is correct
96 Correct 71 ms 13764 KB Output is correct
97 Correct 80 ms 12460 KB Output is correct
98 Correct 100 ms 9296 KB Output is correct
99 Correct 109 ms 10140 KB Output is correct
100 Correct 98 ms 12368 KB Output is correct
101 Correct 414 ms 8272 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 43 ms 3984 KB Output is correct
104 Correct 43 ms 3920 KB Output is correct
105 Correct 44 ms 3924 KB Output is correct
106 Correct 43 ms 3920 KB Output is correct
107 Correct 46 ms 3924 KB Output is correct
108 Correct 45 ms 3920 KB Output is correct
109 Correct 44 ms 4176 KB Output is correct
110 Correct 41 ms 3952 KB Output is correct
111 Correct 60 ms 5972 KB Output is correct
112 Correct 287 ms 6992 KB Output is correct
113 Correct 492 ms 6740 KB Output is correct
114 Correct 524 ms 6996 KB Output is correct
115 Correct 190 ms 9008 KB Output is correct
116 Correct 226 ms 9080 KB Output is correct
117 Correct 119 ms 9040 KB Output is correct
118 Correct 87 ms 9040 KB Output is correct
119 Correct 790 ms 8484 KB Output is correct
120 Correct 1419 ms 8728 KB Output is correct
121 Correct 224 ms 8224 KB Output is correct
122 Correct 81 ms 13652 KB Output is correct
123 Correct 73 ms 12756 KB Output is correct
124 Correct 81 ms 13456 KB Output is correct
125 Correct 0 ms 348 KB Output is correct
126 Correct 0 ms 348 KB Output is correct
127 Correct 49 ms 3924 KB Output is correct
128 Correct 45 ms 3928 KB Output is correct
129 Correct 46 ms 3920 KB Output is correct
130 Correct 43 ms 3988 KB Output is correct
131 Correct 47 ms 3920 KB Output is correct
132 Correct 52 ms 3848 KB Output is correct
133 Correct 50 ms 3824 KB Output is correct
134 Correct 42 ms 3920 KB Output is correct
135 Correct 50 ms 4688 KB Output is correct
136 Correct 48 ms 4468 KB Output is correct
137 Correct 58 ms 4688 KB Output is correct
138 Correct 58 ms 4800 KB Output is correct
139 Correct 50 ms 4620 KB Output is correct
140 Correct 47 ms 4432 KB Output is correct
141 Correct 54 ms 4524 KB Output is correct
142 Correct 57 ms 4588 KB Output is correct
143 Correct 45 ms 4652 KB Output is correct
144 Correct 0 ms 344 KB Output is correct
145 Correct 43 ms 4716 KB Output is correct
146 Correct 45 ms 4432 KB Output is correct
147 Correct 71 ms 5432 KB Output is correct
148 Correct 71 ms 5708 KB Output is correct
149 Correct 81 ms 5456 KB Output is correct
150 Correct 92 ms 12924 KB Output is correct
151 Correct 80 ms 13136 KB Output is correct
152 Correct 86 ms 12852 KB Output is correct
153 Correct 82 ms 13140 KB Output is correct
154 Correct 90 ms 12784 KB Output is correct
155 Correct 77 ms 13196 KB Output is correct
156 Correct 140 ms 5456 KB Output is correct
157 Correct 122 ms 5388 KB Output is correct
158 Correct 80 ms 13672 KB Output is correct
159 Correct 85 ms 12452 KB Output is correct
160 Correct 96 ms 9212 KB Output is correct
161 Correct 139 ms 10064 KB Output is correct
162 Correct 98 ms 12372 KB Output is correct
163 Correct 421 ms 8272 KB Output is correct
164 Correct 53 ms 5596 KB Output is correct
165 Correct 56 ms 5768 KB Output is correct
166 Correct 64 ms 5268 KB Output is correct
167 Correct 61 ms 4432 KB Output is correct
168 Correct 186 ms 5764 KB Output is correct
169 Correct 59 ms 6080 KB Output is correct
170 Correct 300 ms 6992 KB Output is correct
171 Correct 503 ms 6744 KB Output is correct
172 Correct 544 ms 7132 KB Output is correct
173 Correct 193 ms 8968 KB Output is correct
174 Correct 243 ms 9032 KB Output is correct
175 Correct 128 ms 9044 KB Output is correct
176 Correct 82 ms 9040 KB Output is correct
177 Correct 810 ms 8548 KB Output is correct
178 Correct 1438 ms 8528 KB Output is correct
179 Correct 218 ms 8260 KB Output is correct
180 Correct 85 ms 12992 KB Output is correct
181 Correct 77 ms 13036 KB Output is correct
182 Correct 76 ms 13092 KB Output is correct
183 Correct 109 ms 12880 KB Output is correct
184 Correct 74 ms 12368 KB Output is correct
185 Execution timed out 4059 ms 9680 KB Time limit exceeded
186 Halted 0 ms 0 KB -