Submission #944403

#TimeUsernameProblemLanguageResultExecution timeMemory
944403rainboy고기잡이 (KOI13_fish)C11
0 / 18
1 ms348 KiB
#include <stdio.h> #define N 100 int max(int a, int b) { return a > b ? a : b; } unsigned int X = 12345; int rand_() { return (X *= 3) >> 1; } int xx[N], yy[N]; void sort(int *ii, int l, int r) { while (l < r) { int i = l, j = l, k = r, i_ = ii[l + rand_() % (r - l)], tmp; while (j < k) if (xx[ii[j]] == xx[i_]) j++; else if (xx[ii[j]] < xx[i_]) { tmp = ii[i], ii[i] = ii[j], ii[j] = tmp; i++, j++; } else { k--; tmp = ii[j], ii[j] = ii[k], ii[k] = tmp; } sort(ii, l, i); l = k; } } int main() { static int ii[N], jj[N]; int n, l, d, g, h, i, j, ans; scanf("%*d%d%d", &l, &n), l /= 2; for (i = 0; i < n; i++) scanf("%d%d", &xx[i], &yy[i]); for (i = 0; i < n; i++) ii[i] = i; sort(ii, 0, n); ans = 0; for (i = 0; i < n; i++) for (j = i; j < n && xx[ii[j]] - xx[ii[i]] <= l; j++) { for (h = j - i; h > 0 && yy[jj[h - 1]] > yy[ii[j]]; h--) jj[h] = jj[h - 1]; d = l - (xx[ii[j]] - xx[ii[i]]); jj[h] = ii[j]; for (g = 0, h = 0; g < j - i; g++) { while (h < j - i && yy[jj[h]] - yy[jj[g]] <= d) h++; ans = max(ans, h - g); } } printf("%d\n", ans); return 0; }

Compilation message (stderr)

fish.c: In function 'main':
fish.c:38:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |  scanf("%*d%d%d", &l, &n), l /= 2;
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
fish.c:40:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |   scanf("%d%d", &xx[i], &yy[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...