# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
485182 |
2021-11-06T13:20:33 Z |
rainboy |
Nizovi (COI14_nizovi) |
C |
|
180 ms |
260 KB |
#include <stdio.h>
#define N 1000
int cmp(int i, int j) {
int x;
printf("cmp %d %d\n", i + 1, j + 1), fflush(stdout);
scanf("%d", &x);
return x;
}
void rotate(int i, int n, int m) {
if (n + m > 1)
printf("reverse %d %d\n", i + 1, i + n + m), fflush(stdout);
if (m > 1)
printf("reverse %d %d\n", i + 1, i + m), fflush(stdout);
if (n > 1)
printf("reverse %d %d\n", i + m + 1, i + n + m), fflush(stdout);
}
int main() {
static int jj[N];
int na, nb, i, j;
scanf("%d%d", &na, &nb);
for (i = 0; i < na; i++) {
int lower = -1, upper = nb;
while (upper - lower > 1) {
j = (lower + upper) / 2;
if (cmp(na + j, i) < 0)
lower = j;
else
upper = j;
}
jj[i] = upper;
}
for (i = 0, j = 0; i < na; i++)
if (j < jj[i])
rotate(i + j, na - i, jj[i] - j);
printf("end\n"), fflush(stdout);
return 0;
}
Compilation message
nizovi.c: In function 'cmp':
nizovi.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
9 | scanf("%d", &x);
| ^~~~~~~~~~~~~~~
nizovi.c: In function 'main':
nizovi.c:26:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
26 | scanf("%d%d", &na, &nb);
| ^~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Incorrect |
2 |
Incorrect |
2 ms |
200 KB |
Incorrect |
3 |
Incorrect |
2 ms |
200 KB |
Incorrect |
4 |
Incorrect |
36 ms |
256 KB |
Incorrect |
5 |
Incorrect |
33 ms |
200 KB |
Incorrect |
6 |
Incorrect |
51 ms |
200 KB |
Incorrect |
7 |
Incorrect |
162 ms |
256 KB |
Total cost of reverse commands > 3 000 000 |
8 |
Incorrect |
180 ms |
256 KB |
Total cost of reverse commands > 3 000 000 |
9 |
Incorrect |
179 ms |
260 KB |
Total cost of reverse commands > 3 000 000 |
10 |
Incorrect |
97 ms |
256 KB |
Total cost of reverse commands > 3 000 000 |