제출 #1110298

#제출 시각아이디문제언어결과실행 시간메모리
1110298KasymKSegments (IZhO18_segments)C++17
7 / 100
5077 ms1480 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} int f(int a, int b, int c, int d){ if(a>c) swap(a,c), swap(b,d); if(b<c) return 0; if(b<=d) return b-c+1; return d-c+1; } const int N = 2e5+5; bool is[N]; int main(){ // freopen("file.txt", "r", stdin); int q, t, answer = 0; scanf("%d%d", &q, &t); vector<pii> S; while(q--){ int op; scanf("%d", &op); if(op==1){ int a, b; scanf("%d%d", &a, &b); int l = a^(t*answer), r = b^(t*answer); if(l>r) swap(l, r); S.pb({l, r}); } else if(op==2){ int need; scanf("%d", &need); is[--need] = 1; } else{ int a, b, k; scanf("%d%d%d", &a, &b, &k); int l = a^(t*answer), r = b^(t*answer); if(l>r) swap(l, r); answer = 0; for(int i = 0; i < (int)S.size(); ++i){ if(is[i]) continue; answer += (f(l, r, S[i].ff, S[i].ss)) >= k; } printf("%d\n", answer); } } return 0; }

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

segments.cpp: In function 'int main()':
segments.cpp:32:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |  scanf("%d%d", &q, &t);
      |  ~~~~~^~~~~~~~~~~~~~~~
segments.cpp:36:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |   scanf("%d", &op);
      |   ~~~~~^~~~~~~~~~~
segments.cpp:39:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |    scanf("%d%d", &a, &b);
      |    ~~~~~^~~~~~~~~~~~~~~~
segments.cpp:47:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |    scanf("%d", &need);
      |    ~~~~~^~~~~~~~~~~~~
segments.cpp:52:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |    scanf("%d%d%d", &a, &b, &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...