Submission #864683

# Submission time Handle Problem Language Result Execution time Memory
864683 2023-10-23T12:23:34 Z Trisanu_Das Mađioničar (COI22_madionicar) C++17
100 / 100
1217 ms 600 KB
#include <bits/stdc++.h>
using namespace std; 

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);
}

Compilation message

Main.cpp: In function 'int query(int, int)':
Main.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  scanf("%d", &x);
      |  ~~~~~^~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 74 ms 344 KB Output is correct
2 Correct 61 ms 344 KB Output is correct
3 Correct 64 ms 344 KB Output is correct
4 Correct 67 ms 344 KB Output is correct
5 Correct 60 ms 344 KB Output is correct
6 Correct 70 ms 344 KB Output is correct
7 Correct 61 ms 344 KB Output is correct
8 Correct 58 ms 344 KB Output is correct
9 Correct 65 ms 344 KB Output is correct
10 Correct 64 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 344 KB Output is correct
2 Correct 61 ms 344 KB Output is correct
3 Correct 64 ms 344 KB Output is correct
4 Correct 67 ms 344 KB Output is correct
5 Correct 60 ms 344 KB Output is correct
6 Correct 70 ms 344 KB Output is correct
7 Correct 61 ms 344 KB Output is correct
8 Correct 58 ms 344 KB Output is correct
9 Correct 65 ms 344 KB Output is correct
10 Correct 64 ms 344 KB Output is correct
11 Correct 618 ms 344 KB Output is correct
12 Correct 652 ms 344 KB Output is correct
13 Correct 709 ms 344 KB Output is correct
14 Correct 592 ms 344 KB Output is correct
15 Correct 622 ms 344 KB Output is correct
16 Correct 649 ms 344 KB Output is correct
17 Correct 601 ms 344 KB Output is correct
18 Correct 632 ms 344 KB Output is correct
19 Correct 608 ms 344 KB Output is correct
20 Correct 632 ms 344 KB Output is correct
21 Correct 616 ms 344 KB Output is correct
22 Correct 704 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 932 ms 344 KB Output is correct
2 Correct 755 ms 344 KB Output is correct
3 Correct 1016 ms 344 KB Output is correct
4 Correct 1042 ms 344 KB Output is correct
5 Correct 897 ms 344 KB Output is correct
6 Correct 887 ms 344 KB Output is correct
7 Correct 911 ms 344 KB Output is correct
8 Correct 911 ms 344 KB Output is correct
9 Correct 965 ms 600 KB Output is correct
10 Correct 1036 ms 344 KB Output is correct
11 Correct 1041 ms 344 KB Output is correct
12 Correct 1034 ms 344 KB Output is correct
13 Correct 1014 ms 344 KB Output is correct
14 Correct 951 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 344 KB Output is correct
2 Correct 61 ms 344 KB Output is correct
3 Correct 64 ms 344 KB Output is correct
4 Correct 67 ms 344 KB Output is correct
5 Correct 60 ms 344 KB Output is correct
6 Correct 70 ms 344 KB Output is correct
7 Correct 61 ms 344 KB Output is correct
8 Correct 58 ms 344 KB Output is correct
9 Correct 65 ms 344 KB Output is correct
10 Correct 64 ms 344 KB Output is correct
11 Correct 618 ms 344 KB Output is correct
12 Correct 652 ms 344 KB Output is correct
13 Correct 709 ms 344 KB Output is correct
14 Correct 592 ms 344 KB Output is correct
15 Correct 622 ms 344 KB Output is correct
16 Correct 649 ms 344 KB Output is correct
17 Correct 601 ms 344 KB Output is correct
18 Correct 632 ms 344 KB Output is correct
19 Correct 608 ms 344 KB Output is correct
20 Correct 632 ms 344 KB Output is correct
21 Correct 616 ms 344 KB Output is correct
22 Correct 704 ms 344 KB Output is correct
23 Correct 932 ms 344 KB Output is correct
24 Correct 755 ms 344 KB Output is correct
25 Correct 1016 ms 344 KB Output is correct
26 Correct 1042 ms 344 KB Output is correct
27 Correct 897 ms 344 KB Output is correct
28 Correct 887 ms 344 KB Output is correct
29 Correct 911 ms 344 KB Output is correct
30 Correct 911 ms 344 KB Output is correct
31 Correct 965 ms 600 KB Output is correct
32 Correct 1036 ms 344 KB Output is correct
33 Correct 1041 ms 344 KB Output is correct
34 Correct 1034 ms 344 KB Output is correct
35 Correct 1014 ms 344 KB Output is correct
36 Correct 951 ms 344 KB Output is correct
37 Correct 951 ms 344 KB Output is correct
38 Correct 937 ms 344 KB Output is correct
39 Correct 1200 ms 344 KB Output is correct
40 Correct 1217 ms 344 KB Output is correct
41 Correct 1126 ms 600 KB Output is correct
42 Correct 935 ms 344 KB Output is correct
43 Correct 943 ms 344 KB Output is correct
44 Correct 1026 ms 344 KB Output is correct
45 Correct 993 ms 344 KB Output is correct
46 Correct 1086 ms 344 KB Output is correct
47 Correct 985 ms 344 KB Output is correct
48 Correct 1041 ms 344 KB Output is correct
49 Correct 1016 ms 344 KB Output is correct
50 Correct 979 ms 344 KB Output is correct
51 Correct 1046 ms 344 KB Output is correct
52 Correct 956 ms 340 KB Output is correct