Submission #1268776

#TimeUsernameProblemLanguageResultExecution timeMemory
1268776SmuggingSpunSegments (IZhO18_segments)C++20
0 / 100
0 ms328 KiB
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
int n, t;
namespace sub1{
	void solve(){
		vector<pair<int, int>>range;
		for(int _ = 0, last_ans = 0; _ < n; _++){
			int type;
			cin >> type;
			if(type == 1){
				int a, b;
				cin >> a >> b;
				if(t == 1){
					a ^= last_ans;
					b ^= last_ans;
				}
				range.emplace_back(a, b);
			}
			else if(type == 2){
				int id;
				cin >> id;
				range.erase(range.begin() + id - 1);
			}
			else{
				int a, b, k, ans = 0;
				cin >> a >> b >> k;
				if(t == 1){
					a ^= last_ans;
					b ^= last_ans;
				}
				for(int i = 0; i < range.size(); i++){
					if(min(range[i].second, b) - max(range[i].first, a) + 1 >= k){
						ans++;
					}
				}
				cout << (last_ans = ans) << "\n";
			}
		}
	}
}
namespace sub23456{
	void solve(){
		
	}
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	if(fopen(taskname".inp", "r")){
		freopen(taskname".inp", "r", stdin);
	}
	cin >> n >> t;
	if(n <= 5000){
		sub1::solve();
	}
	else{
		sub23456::solve();
	}
}

Compilation message (stderr)

segments.cpp: In function 'int main()':
segments.cpp:50:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...