답안 #780992

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
780992 2023-07-12T15:28:39 Z rainboy Mađioničar (COI22_madionicar) C
100 / 100
1580 ms 276 KB
#include <stdio.h>

int max(int a, int b) { return a > b ? a : b; }

int query(int i, int j) {
	int x;

	printf("? %d %d\n", i + 1, j + 1), fflush(stdout);
	scanf("%d", &x);
	return x;
}

int main() {
	int n, t, i, l, l_;

	scanf("%d", &n);
	l_ = 0;
	for (t = 0; t <= 1; t++) {
		for (i = 0, l = t; i < n; i++)
			while (i > 0 && i + l < n && query(i - 1, i + l))
				i--, l += 2;
		l_ = max(l_, l);
	}
	printf("! %d\n", l_), fflush(stdout);
	return 0;
}

Compilation message

Main.c: In function 'query':
Main.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &x);
      |  ^~~~~~~~~~~~~~~
Main.c: In function 'main':
Main.c:16:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 106 ms 208 KB Output is correct
2 Correct 110 ms 208 KB Output is correct
3 Correct 106 ms 208 KB Output is correct
4 Correct 108 ms 208 KB Output is correct
5 Correct 131 ms 208 KB Output is correct
6 Correct 122 ms 208 KB Output is correct
7 Correct 78 ms 208 KB Output is correct
8 Correct 117 ms 208 KB Output is correct
9 Correct 117 ms 208 KB Output is correct
10 Correct 89 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 106 ms 208 KB Output is correct
2 Correct 110 ms 208 KB Output is correct
3 Correct 106 ms 208 KB Output is correct
4 Correct 108 ms 208 KB Output is correct
5 Correct 131 ms 208 KB Output is correct
6 Correct 122 ms 208 KB Output is correct
7 Correct 78 ms 208 KB Output is correct
8 Correct 117 ms 208 KB Output is correct
9 Correct 117 ms 208 KB Output is correct
10 Correct 89 ms 208 KB Output is correct
11 Correct 673 ms 208 KB Output is correct
12 Correct 858 ms 208 KB Output is correct
13 Correct 1052 ms 208 KB Output is correct
14 Correct 966 ms 208 KB Output is correct
15 Correct 809 ms 208 KB Output is correct
16 Correct 1055 ms 208 KB Output is correct
17 Correct 896 ms 208 KB Output is correct
18 Correct 998 ms 208 KB Output is correct
19 Correct 879 ms 208 KB Output is correct
20 Correct 916 ms 208 KB Output is correct
21 Correct 943 ms 208 KB Output is correct
22 Correct 844 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1401 ms 208 KB Output is correct
2 Correct 1145 ms 276 KB Output is correct
3 Correct 1405 ms 272 KB Output is correct
4 Correct 1200 ms 276 KB Output is correct
5 Correct 790 ms 208 KB Output is correct
6 Correct 1451 ms 272 KB Output is correct
7 Correct 1262 ms 208 KB Output is correct
8 Correct 1354 ms 256 KB Output is correct
9 Correct 1094 ms 208 KB Output is correct
10 Correct 1580 ms 208 KB Output is correct
11 Correct 1481 ms 208 KB Output is correct
12 Correct 1294 ms 208 KB Output is correct
13 Correct 1280 ms 208 KB Output is correct
14 Correct 896 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 106 ms 208 KB Output is correct
2 Correct 110 ms 208 KB Output is correct
3 Correct 106 ms 208 KB Output is correct
4 Correct 108 ms 208 KB Output is correct
5 Correct 131 ms 208 KB Output is correct
6 Correct 122 ms 208 KB Output is correct
7 Correct 78 ms 208 KB Output is correct
8 Correct 117 ms 208 KB Output is correct
9 Correct 117 ms 208 KB Output is correct
10 Correct 89 ms 208 KB Output is correct
11 Correct 673 ms 208 KB Output is correct
12 Correct 858 ms 208 KB Output is correct
13 Correct 1052 ms 208 KB Output is correct
14 Correct 966 ms 208 KB Output is correct
15 Correct 809 ms 208 KB Output is correct
16 Correct 1055 ms 208 KB Output is correct
17 Correct 896 ms 208 KB Output is correct
18 Correct 998 ms 208 KB Output is correct
19 Correct 879 ms 208 KB Output is correct
20 Correct 916 ms 208 KB Output is correct
21 Correct 943 ms 208 KB Output is correct
22 Correct 844 ms 208 KB Output is correct
23 Correct 1401 ms 208 KB Output is correct
24 Correct 1145 ms 276 KB Output is correct
25 Correct 1405 ms 272 KB Output is correct
26 Correct 1200 ms 276 KB Output is correct
27 Correct 790 ms 208 KB Output is correct
28 Correct 1451 ms 272 KB Output is correct
29 Correct 1262 ms 208 KB Output is correct
30 Correct 1354 ms 256 KB Output is correct
31 Correct 1094 ms 208 KB Output is correct
32 Correct 1580 ms 208 KB Output is correct
33 Correct 1481 ms 208 KB Output is correct
34 Correct 1294 ms 208 KB Output is correct
35 Correct 1280 ms 208 KB Output is correct
36 Correct 896 ms 208 KB Output is correct
37 Correct 1185 ms 208 KB Output is correct
38 Correct 1079 ms 208 KB Output is correct
39 Correct 1333 ms 208 KB Output is correct
40 Correct 1425 ms 208 KB Output is correct
41 Correct 1316 ms 208 KB Output is correct
42 Correct 1446 ms 208 KB Output is correct
43 Correct 1335 ms 208 KB Output is correct
44 Correct 885 ms 276 KB Output is correct
45 Correct 1399 ms 208 KB Output is correct
46 Correct 964 ms 208 KB Output is correct
47 Correct 1450 ms 208 KB Output is correct
48 Correct 854 ms 208 KB Output is correct
49 Correct 1407 ms 208 KB Output is correct
50 Correct 1357 ms 208 KB Output is correct
51 Correct 1171 ms 276 KB Output is correct
52 Correct 1501 ms 208 KB Output is correct