//-------------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;
int tp, a, b, k;
while (n--) {
cin >> tp;
if (tp == 3) break;
cin >> a >> b;
if (a > b) swap(a, b);
v.pb({ a,b });
}
cin >> a >> b >> k;
if (a > b) swap(a, b);
int lastans = 0;
for (auto it : v) {
if (min(it.second, b) - max(it.first, a) + 1 >= k) lastans++;
}
cout << lastans << '\n';
while (n--) {
cin >> tp >> a >> b >> k;
a ^= (t * lastans), b ^= (t * lastans);
if (a > b) swap(a, b);
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
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------------------------\\
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3437 ms |
1316 KB |
Output is correct |
2 |
Correct |
3403 ms |
1556 KB |
Output is correct |
3 |
Correct |
3427 ms |
1824 KB |
Output is correct |
4 |
Correct |
3383 ms |
1436 KB |
Output is correct |
5 |
Correct |
740 ms |
1496 KB |
Output is correct |
6 |
Correct |
385 ms |
1496 KB |
Output is correct |
7 |
Correct |
3449 ms |
1432 KB |
Output is correct |
8 |
Correct |
3399 ms |
3940 KB |
Output is correct |
9 |
Correct |
3405 ms |
4080 KB |
Output is correct |
10 |
Correct |
2151 ms |
4356 KB |
Output is correct |
11 |
Correct |
2716 ms |
4456 KB |
Output is correct |
12 |
Correct |
2861 ms |
3888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
836 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |