제출 #432968

#제출 시각아이디문제언어결과실행 시간메모리
432968rainboyArchery (IOI09_archery)C11
18 / 100
10 ms304 KiB
#include <stdio.h> #include <string.h> #define N 200000 int main() { static int aa[N * 2], bb[N * 2], pp[N * 2]; static char used[N]; int n, r, p, p_, i, i_, a; scanf("%d%d", &n, &r); if (n > 200) { printf(":(\n"); return 0; } for (i = 0; i < n * 2; i++) scanf("%d", &aa[i]), aa[i]--; i_ = -1, p_ = n * 2; for (i = 0; i < n * 2; i++) { int tmp; if (i > 0) tmp = aa[i], aa[i] = aa[i - 1], aa[i - 1] = tmp; memcpy(bb, aa, n * 2 * sizeof *aa); for (p = 0; p < n * 2; p++) pp[aa[p]] = p / 2; if (aa[i] == 0) p = 0; else if (aa[i] >= n + 1) { memset(used, 0, n * sizeof *used), used[0] = 1; for (a = n * 2 - 1; a >= aa[i]; a--) { p = pp[a]; while (used[p]) p = (p - 1 + n) % n; used[p] = 1; } } else { memset(used, 0, n * sizeof *used); for (a = 0; a <= aa[i]; a++) { p = pp[a]; while (used[p] && (p != pp[0] || pp[a] < p)) p = (p + 1) % n; used[p] = 1; } p = (p - r % n + n) % n; } if (p_ >= p) p_ = p, i_ = i / 2; } printf("%d\n", i_ + 1); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

archery.c: In function 'main':
archery.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d%d", &n, &r);
      |  ^~~~~~~~~~~~~~~~~~~~~
archery.c:17:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%d", &aa[i]), aa[i]--;
      |   ^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...