Submission #667063

# Submission time Handle Problem Language Result Execution time Memory
667063 2022-11-30T09:59:35 Z Kaztaev_Alisher Segments (IZhO18_segments) C++17
7 / 100
5000 ms 3092 KB
//#pragma GCC optomize ("Ofast")
//#pragma GCC optomize ("unroll-loops")
//#pragma GCC target ("avx,avx2,fma")

#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define sz size
#define cl clear
#define ins insert
#define ers erase
#define pii pair < int , int >
#define pll pair< long long  , long long >
#define all(x) x.begin() , x.end()
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define tostr(x) to_string(x)
#define tonum(s) atoi(s.c_str())
#define seon(x) setprecision(x)
#define bpop(x) __builtin_popcount(x)
#define deb(x) cerr << #x  << " = " << x << endl;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
const double PI = 3.14159265;

const ll N = 1e5+5;
const ll mod = 1e9+7;
const ll inf = 1e9;
const ll INF = 1e18;

using namespace std;

pii p[N];
bool was[N];
void solve(){
	int n , t;
	cin >> n >> t;
	int cnt = 0 , lst = 0;
	while(n--){
		int tp ;
		cin >> tp;
		if(tp == 1){
			int l , r;
			cin >> l >> r;
			l = (l ^ (t*lst));
			r = (r ^ (t*lst));
			if(l > r)swap(l,r);
			p[++cnt] = {l , r};
		} else if (tp == 2){
			int id;
			cin >> id;
			was[id] = 1;
		} else {
			int l , r , ans = 0 , k;
			cin >> l >> r >> k;
			l = (l ^ (t*lst));
			r = (r ^ (t*lst));
			if(l > r) swap(l,r);
			for(int i = 1; i <= cnt; i++){
				if(was[i] == 1) continue;
				int L = p[i].F , R = p[i].S , res = 0;
				if(l <= L && R <= r) res = R-L+1;
				else if(l <= L && L <= r) res = r-L+1;
				else if(l <= R && R <= r) res = R-l+1;
				else if(L <= l && r <= R) res = r-l+1;
				else res = 0;
				if(res >= k) ans++;
			}
			lst = ans;
			cout << ans <<"\n";
		}
	}
}
signed main(){
	ios;
	solve();
	return 0;
}
/*
6 0
1 3 10
1 3 5

3 6 10 6

2 1

1 3 10

3 6 4 2
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 26 ms 468 KB Output is correct
6 Correct 34 ms 468 KB Output is correct
7 Correct 14 ms 448 KB Output is correct
8 Correct 18 ms 468 KB Output is correct
9 Correct 17 ms 472 KB Output is correct
10 Correct 7 ms 468 KB Output is correct
11 Correct 50 ms 484 KB Output is correct
12 Correct 46 ms 468 KB Output is correct
13 Correct 9 ms 468 KB Output is correct
14 Correct 19 ms 468 KB Output is correct
15 Correct 3 ms 340 KB Output is correct
16 Correct 4 ms 340 KB Output is correct
17 Correct 20 ms 460 KB Output is correct
18 Correct 12 ms 488 KB Output is correct
19 Correct 18 ms 444 KB Output is correct
20 Correct 18 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5082 ms 2528 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 511 ms 2440 KB Output is correct
2 Correct 426 ms 2656 KB Output is correct
3 Correct 624 ms 2572 KB Output is correct
4 Correct 477 ms 2656 KB Output is correct
5 Execution timed out 5070 ms 2956 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 487 ms 2676 KB Output is correct
2 Correct 420 ms 2744 KB Output is correct
3 Correct 444 ms 2740 KB Output is correct
4 Correct 451 ms 2696 KB Output is correct
5 Execution timed out 5068 ms 3092 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 26 ms 468 KB Output is correct
6 Correct 34 ms 468 KB Output is correct
7 Correct 14 ms 448 KB Output is correct
8 Correct 18 ms 468 KB Output is correct
9 Correct 17 ms 472 KB Output is correct
10 Correct 7 ms 468 KB Output is correct
11 Correct 50 ms 484 KB Output is correct
12 Correct 46 ms 468 KB Output is correct
13 Correct 9 ms 468 KB Output is correct
14 Correct 19 ms 468 KB Output is correct
15 Correct 3 ms 340 KB Output is correct
16 Correct 4 ms 340 KB Output is correct
17 Correct 20 ms 460 KB Output is correct
18 Correct 12 ms 488 KB Output is correct
19 Correct 18 ms 444 KB Output is correct
20 Correct 18 ms 440 KB Output is correct
21 Execution timed out 5082 ms 2528 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 26 ms 468 KB Output is correct
6 Correct 34 ms 468 KB Output is correct
7 Correct 14 ms 448 KB Output is correct
8 Correct 18 ms 468 KB Output is correct
9 Correct 17 ms 472 KB Output is correct
10 Correct 7 ms 468 KB Output is correct
11 Correct 50 ms 484 KB Output is correct
12 Correct 46 ms 468 KB Output is correct
13 Correct 9 ms 468 KB Output is correct
14 Correct 19 ms 468 KB Output is correct
15 Correct 3 ms 340 KB Output is correct
16 Correct 4 ms 340 KB Output is correct
17 Correct 20 ms 460 KB Output is correct
18 Correct 12 ms 488 KB Output is correct
19 Correct 18 ms 444 KB Output is correct
20 Correct 18 ms 440 KB Output is correct
21 Execution timed out 5082 ms 2528 KB Time limit exceeded
22 Halted 0 ms 0 KB -