Submission #893654

#TimeUsernameProblemLanguageResultExecution timeMemory
893654vjudge1Segments (IZhO18_segments)C++17
7 / 100
5072 ms10064 KiB
// 以上帝的名义 // 候选硕士 #include <bits/stdc++.h> #ifdef local #include "algo/debug.h" #else #define dbg(x...) 0 #endif using namespace std ; using ll = long long ; using ld = long double ; int32_t main() { int n, t ; scanf("%d%d", &n, &t) ; int last = 0 ; map<pair<int,int>,int> cnt ; map<int,pair<int,int>> ind ; int idx = 0 ; for (int i = 0 ; i < n ; i++ ){ int type ; scanf("%d", &type) ; if (type == 1) { int a, b ; scanf("%d%d", &a, &b) ; int l = (a ^ (last * t)) ; int r = (b ^ (last * t)) ; if (l > r) swap(l, r) ; cnt[{l,r}]++ ; idx++ ; ind[idx] = {l, r} ; // dbg(type, l, r) ; } else if (type == 2) { int j ; cin >> j ; auto c = ind[j] ; cnt[c]-- ; if (cnt[c] == 0) cnt.erase(c) ; } else { int a, b, k ;scanf("%d%d%d", &a, &b, &k) ; int l = (a ^ (t * last)) ; int r = (b ^ (t * last)) ; if (l > r) swap(l, r) ; int ans = 0 ; for (auto [c, p] : cnt) { auto [L, R] = c ; L = max(L, l) , R = min(R , r) ; if (R - L + 1 >= k) { ans++ ; } } // dbg(type, l, r) ; printf("%d\n", ans) ; last = ans ; } } return 0 ; } // 希望白银

Compilation message (stderr)

segments.cpp: In function 'int32_t main()':
segments.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     scanf("%d%d", &n, &t) ;
      |     ~~~~~^~~~~~~~~~~~~~~~
segments.cpp:23:25: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         int type ; scanf("%d", &type) ;
      |                    ~~~~~^~~~~~~~~~~~~
segments.cpp:25:29: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |             int a, b ; scanf("%d%d", &a, &b) ;
      |                        ~~~~~^~~~~~~~~~~~~~~~
segments.cpp:38:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |             int a, b, k ;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...