제출 #797459

#제출 시각아이디문제언어결과실행 시간메모리
797459kingfran1907Segments (IZhO18_segments)C++14
0 / 100
5071 ms5516 KiB
#include <bits/stdc++.h> #define X first #define Y second using namespace std; const int maxn = 2e5+10; int n, t; set< int > s, cur; int l[maxn], r[maxn]; int inter(pair<int, int> a, pair<int, int> b) { if (a.X > b.X) swap(a, b); return min(a.Y, b.Y) - b.X + 1; } int main() { scanf("%d%d", &n, &t); for (int i = 1; i <= n + 2; i++) s.insert(i); int lastans = 0; while (n--) { int type; scanf("%d", &type); if (type == 1) { int ind = *s.begin(); s.erase(s.begin()); int l, r; scanf("%d%d", &l, &r); l = l ^ (t * lastans); r = r ^ (t * lastans); if (l > r) swap(l, r); ::l[ind] = l, ::r[ind] = r; cur.insert(ind); } else if (type == 2) { int x; scanf("%d", &x); cur.erase(x); s.insert(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 (int tren : cur) { lastans += (inter({l, r}, {::l[tren], ::r[tren]}) >= k); } printf("%d\n", lastans); } } return 0; }

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

segments.cpp: In function 'int main()':
segments.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  scanf("%d%d", &n, &t);
      |  ~~~~~^~~~~~~~~~~~~~~~
segments.cpp:25:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |   scanf("%d", &type);
      |   ~~~~~^~~~~~~~~~~~~
segments.cpp:31:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |    scanf("%d%d", &l, &r);
      |    ~~~~~^~~~~~~~~~~~~~~~
segments.cpp:40:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |    scanf("%d", &x);
      |    ~~~~~^~~~~~~~~~
segments.cpp:45:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |    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...