제출 #768840

#제출 시각아이디문제언어결과실행 시간메모리
768840rainboySegments (IZhO18_segments)C11
23 / 100
5056 ms3424 KiB
#include <stdio.h> #define N 200000 int min(int a, int b) { return a < b ? a : b; } int max(int a, int b) { return a > b ? a : b; } int ll[N], rr[N], n; char active[N]; void add(int i) { active[i] = 1; } void remove_(int i) { active[i] = 0; } int query(int l, int r, int k) { int i, cnt; cnt = 0; for (i = 0; i < n; i++) if (active[i] && rr[i] - ll[i] + 1 >= k) { cnt++; if (r - ll[i] + 1 < k) cnt--; if (rr[i] - l + 1 < k) cnt--; } return cnt; } int main() { int q, online, h, i, ans; scanf("%d%d", &q, &online); ans = 0; for (h = 0; h < q; h++) { int t, l, r, k, tmp; scanf("%d", &t); if (t == 1) { scanf("%d%d", &l, &r); if (online) l ^= ans, r ^= ans; if (l > r) tmp = l, l = r, r = tmp; ll[n] = l, rr[n] = r; add(n++); } else if (t == 2) { scanf("%d", &i), i--; remove_(i); } else { scanf("%d%d%d", &l, &r, &k); if (online) l ^= ans, r ^= ans; if (l > r) tmp = l, l = r, r = tmp; printf("%d\n", ans = query(l, r, k)); } } return 0; }

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

segments.c: In function 'main':
segments.c:36:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |  scanf("%d%d", &q, &online);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~
segments.c:41:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |   scanf("%d", &t);
      |   ^~~~~~~~~~~~~~~
segments.c:43:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |    scanf("%d%d", &l, &r);
      |    ^~~~~~~~~~~~~~~~~~~~~
segments.c:51:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |    scanf("%d", &i), i--;
      |    ^~~~~~~~~~~~~~~
segments.c:54:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |    scanf("%d%d%d", &l, &r, &k);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...