Submission #944397

#TimeUsernameProblemLanguageResultExecution timeMemory
944397dilanyanSegments (IZhO18_segments)C++17
0 / 100
3412 ms3936 KiB
//-------------dilanyan------------\\ #define _CRT_SECURE_NO_WARNINGS #include<bits/stdc++.h> #include<stdio.h> using namespace std; //------------------KarginDefines--------------------\\ #define ll long long #define pb push_back #define all(u) (u).begin(), (u).end() #define pqueue priority_queue #define upper upper_bound #define lower lower_bound #define umap unordered_map #define uset unordered_set #define Kargin ios_base::sync_with_stdio(false);cin.tie(NULL); #define Usaco freopen(".in", "r", stdin); freopen(".out", "w", stdout); //-------------------KarginConstants------------------\\ const ll mod = 1000000007; const ll inf = 2e9; //-------------------KarginCode------------------------\\ const int N = 200005; void KarginSolve() { int n, t; cin >> n >> t; vector<pair<int, int>> v; while (n--) { int tp; cin >> tp; if (tp == 3) break; int a, b; cin >> a >> b; v.pb({ a,b }); } int a, b, k; int lastans = 0; for (auto it : v) { if (min(it.second, b) - max(it.first, a) + 1 >= k) lastans++; } cout << lastans << '\n'; while (n--) { int tp, a, b, k; cin >> t >> a >> b >> k; a ^= (tp * lastans), b ^= (tp * lastans); int ans = 0; for (auto it : v) { if (min(it.second, b) - max(it.first, a) + 1 >= k) ans++; } lastans = ans; cout << lastans << '\n'; } } int main() { //Usaco Kargin; int test = 1; //cin >> test; while (test--) { KarginSolve(); } return 0; }

Compilation message (stderr)

segments.cpp:1:1: warning: multi-line comment [-Wcomment]
    1 | //-------------dilanyan------------\\
      | ^
segments.cpp:8:1: warning: multi-line comment [-Wcomment]
    8 | //------------------KarginDefines--------------------\\
      | ^
segments.cpp:22:1: warning: multi-line comment [-Wcomment]
   22 | //-------------------KarginConstants------------------\\
      | ^
segments.cpp:27:1: warning: multi-line comment [-Wcomment]
   27 | //-------------------KarginCode------------------------\\
      | ^
segments.cpp: In function 'void KarginSolve()':
segments.cpp:42:12: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   42 |     int a, b, k;
      |            ^
segments.cpp:42:9: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
   42 |     int a, b, k;
      |         ^
segments.cpp:45:9: warning: 'k' may be used uninitialized in this function [-Wmaybe-uninitialized]
   45 |         if (min(it.second, b) - max(it.first, a) + 1 >= k) lastans++;
      |         ^~
segments.cpp:51:18: warning: 'tp' may be used uninitialized in this function [-Wmaybe-uninitialized]
   51 |         a ^= (tp * lastans), b ^= (tp * lastans);
      |              ~~~~^~~~~~~~~~
#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...