제출 #503238

#제출 시각아이디문제언어결과실행 시간메모리
503238rainboyOsumnjičeni (COCI21_osumnjiceni)C11
0 / 110
267 ms5588 KiB
#include <stdio.h> #include <string.h> #define N 200000 int max(int a, int b) { return a > b ? a : b; } unsigned int X = 12345; int rand_() { return (X *= 3) >> 1; } int xx[N * 2]; 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 * 2], dd[N * 2]; int n, q, i, x, ans; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d%d", &xx[i << 1 | 0], &xx[i << 1 | 1]), xx[i << 1 | 1]++; for (i = 0; i < n * 2; i++) ii[i] = i; sort(ii, 0, n * 2); for (i = 0, x = 0; i < n * 2; i++) xx[ii[i]] = i + 1 == n * 2 || xx[ii[i + 1]] != xx[ii[i]] ? x++ : x; scanf("%d", &q); while (q--) { int l, r; scanf("%d%d", &l, &r), l--, r--; memset(dd, 0, n * 2 * sizeof *dd); for (i = l; i <= r; i++) dd[xx[i << 1 | 0]]++, dd[xx[i << 1 | 1]]--; for (i = 1; i < n * 2; i++) dd[i] += dd[i - 1]; ans = 0; for (i = 0; i < n * 2; i++) ans = max(ans, dd[i]); printf("%d\n", ans); } return 0; }

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

Main.c: In function 'main':
Main.c:39:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
Main.c:41:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |   scanf("%d%d", &xx[i << 1 | 0], &xx[i << 1 | 1]), xx[i << 1 | 1]++;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.c:47:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |  scanf("%d", &q);
      |  ^~~~~~~~~~~~~~~
Main.c:51:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |   scanf("%d%d", &l, &r), l--, r--;
      |   ^~~~~~~~~~~~~~~~~~~~~
#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...