Submission #50723703


Source Code Expand

// LUOGU_RID: 148763548
#include <bits/stdc++.h>
#define int long long
const int N = 2e5+5;
using namespace std;
int n,q;
signed main(){
	cin >> n >> q;
	set<int> st,st2;
	st.insert(n);
	st2.insert(-1);
	while(q--){
		int c,x;cin >> c >> x;
		if(c==1){
			st.insert(x);//right
			st2.insert(-(x+1));//left
		}else{
			int r = *st.lower_bound(x);
			int l = -(*st2.lower_bound(-x));
			cout<<r-l+1<<endl;
		}
	}
	return 0;
}

Submission Info

Submission Time
Task D - Cutting Woods
User Expert_Dream
Language C++ 20 (gcc 12.2)
Score 400
Code Size 445 Byte
Status AC
Exec Time 313 ms
Memory 22344 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 15
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_max_random_00.txt, 01_max_random_01.txt, 01_max_random_02.txt, 01_max_random_03.txt, 01_max_random_04.txt, 02_all_1_00.txt, 03_all_2_00.txt, 04_hack_00.txt, 04_hack_01.txt, 04_hack_02.txt, 04_hack_03.txt, 04_hack_04.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 6 ms 3620 KiB
00_sample_01.txt AC 1 ms 3540 KiB
00_sample_02.txt AC 1 ms 3492 KiB
01_max_random_00.txt AC 313 ms 12948 KiB
01_max_random_01.txt AC 302 ms 12804 KiB
01_max_random_02.txt AC 293 ms 12996 KiB
01_max_random_03.txt AC 296 ms 13056 KiB
01_max_random_04.txt AC 305 ms 12972 KiB
02_all_1_00.txt AC 243 ms 22344 KiB
03_all_2_00.txt AC 261 ms 3400 KiB
04_hack_00.txt AC 159 ms 22028 KiB
04_hack_01.txt AC 154 ms 22196 KiB
04_hack_02.txt AC 252 ms 12836 KiB
04_hack_03.txt AC 247 ms 12792 KiB
04_hack_04.txt AC 252 ms 12872 KiB