제출 #290501

#제출 시각아이디문제언어결과실행 시간메모리
290501luciocfSegments (IZhO18_segments)C++14
7 / 100
5065 ms6776 KiB
#include <bits/stdc++.h> #define ff first #define ss second using namespace std; typedef pair<int, int> pii; const int maxn = 1e5+10; const int maxv = 2e9+10; pii range[maxn]; int intersect(pii a, pii b) { if (a.ff > b.ss || a.ss < b.ff) return 0; if (a.ff >= b.ff && a.ss <= b.ss) return a.ss-a.ff+1; if (a.ff >= b.ff) return b.ss-a.ff+1; return a.ss-b.ff+1; } int main(void) { int q, t; scanf("%d %d", &q, &t); int lastans = 0; int ind = 0; multiset<pii> st; while (q--) { int op; scanf("%d", &op); if (op == 1) { int l, r; scanf("%d %d", &l, &r); l = (l ^ (t*lastans)); r = (r ^ (t*lastans)); if (l > r) swap(l, r); range[++ind] = {l, r}; st.insert(range[ind]); } else if (op == 2) { int x; scanf("%d", &x); st.erase(st.find(range[x])); } else { int l, r, k; scanf("%d %d %d", &l, &r, &k); l = (l ^ (t*lastans)); r = (r ^ (t*lastans)); if (l > r) swap(l, r); lastans = 0; for (auto pp: st) if (intersect(pp, {l, r}) >= k) lastans++; printf("%d\n", lastans); } } }

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

segments.cpp: In function 'int main()':
segments.cpp:29:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   29 |  scanf("%d %d", &q, &t);
      |  ~~~~~^~~~~~~~~~~~~~~~~
segments.cpp:39:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   39 |   scanf("%d", &op);
      |   ~~~~~^~~~~~~~~~~
segments.cpp:44:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   44 |    scanf("%d %d", &l, &r);
      |    ~~~~~^~~~~~~~~~~~~~~~~
segments.cpp:57:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   57 |    scanf("%d", &x);
      |    ~~~~~^~~~~~~~~~
segments.cpp:64:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   64 |    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...