QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#420058#2815. 组合数据结构问题300_205_205#AC ✓8ms3892kbC++142.5kb2024-05-24 14:24:352024-05-24 14:24:37

Judging History

你现在查看的是最新测评结果

  • [2024-05-24 14:24:37]
  • 评测
  • 测评结果:AC
  • 用时:8ms
  • 内存:3892kb
  • [2024-05-24 14:24:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rg register
#define ll long long
#define ull unsigned ll
#define lowbit(x) (x&(-x))
#define djq 998244353
const double eps=1e-10;
const short sint=0x3f3f;
const int inf=0x3f3f3f3f;
const ll linf=0x3f3f3f3f3f3f3f3f;
const double alpha=0.73;
const double PI=acos(-1);
inline void file(){
	freopen("entrench.in","r",stdin);
	freopen("entrench.out","w",stdout);
}
inline ll read(){
	rg ll ret=0,f=0;char ch=getchar();
    while(!isdigit(ch)){if(ch==EOF)exit(0);if(ch=='-')f=1;ch=getchar();}
    while(isdigit(ch)){ret=ret*10+ch-48;ch=getchar();}
    return f?-ret:ret;
}

#define ep emplace
#define epb emplace_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define it iterator
#define mkp make_pair
#define naive return 0*puts("Yes")
#define angry return 0*puts("No")
#define fls fflush(stdout)
#define rep(i,x,y) for(rg int i=(x);i<=(y);++i)
#define per(i,x,y) for(rg int i=(x);i>=(y);--i)
#define rep0(i,a) for(rg int i=0;i<=a;++i)
#define per0(i,a) for(rg int i=a;~i;--i)
#define szf sizeof
typedef vector<int> vec;
typedef pair<int,int> pii;
struct point{ int x,y; point(int x=0,int y=0):x(x),y(y) {} inline bool operator<(const point& T)const{ return x^T.x?x<T.x:y<T.y; }; };
inline int ksm(int base,int p){int ret=1;while(p){if(p&1)ret=1ll*ret*base%djq;base=1ll*base*base%djq,p>>=1;}return ret;}
inline void pls(int& x,const int k){ x=(x+k>=djq?x+k-djq:x+k); }
inline int add(const int a,const int b){ return a+b>=djq?a+b-djq:a+b; }
inline void sub(int& x,const int k){ x=(x-k<0?x-k+djq:x-k); }
inline int inc(const int a,const int b){ return a<b?a-b+djq:a-b; }
inline void ckmn(int& x,const int k){ x=(k<x?k:x); }
inline void ckmx(int& x,const int k){ x=(k>x?k:x); }
inline void ckmn(ll& x,const ll k){ x=(k<x?k:x); }
inline void ckmx(ll& x,const ll k){ x=(k>x?k:x); }
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int n,m,fla[4];
queue<ll> a;
stack<ll> b;
priority_queue<ll> c,d;
signed main(){
//	file();
	n=read();
	rep(i,0,3) fla[i]=1;
	rep(i,1,n){
		const int opt=read();
		const ll x=read();
		if(opt==1){
			a.push(x);
			b.push(x);
			c.push(x);
			d.push(-x);
			++m;
		}else{
			if(m==0){
				fla[0]=fla[1]=fla[2]=fla[3]=0;
				break;
			}
			fla[0]&=(a.front()==x);
			fla[1]&=(b.top()==x);
			fla[2]&=(c.top()==x);
			fla[3]&=(d.top()==-x);
			a.pop(),b.pop(),c.pop(),d.pop();
			--m;
		}
	}
	rep(i,0,3) puts(fla[i]?"Yes":"No");
	return 0; 
}
/*

*/

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3628kb

input:

6
1 1
1 2
1 3
2 1
2 2
2 3

output:

Yes
No
No
Yes

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 7ms
memory: 3884kb

input:

100000
1 49
1 59
2 49
1 98
2 59
2 98
1 95
1 34
1 64
2 95
1 18
1 44
1 7
1 78
2 34
2 64
2 18
1 37
2 44
1 89
2 7
1 2
1 21
2 78
2 37
1 90
1 75
1 50
1 33
1 70
1 32
2 89
2 2
1 49
2 21
1 46
2 90
1 3
2 75
1 50
1 37
1 24
1 88
1 78
2 50
1 22
1 73
1 95
1 100
2 33
1 28
1 62
1 25
2 70
1 90
2 32
1 31
2 49
2 46
2 ...

output:

Yes
No
No
No

result:

ok 4 lines

Test #3:

score: 0
Accepted
time: 8ms
memory: 3696kb

input:

100000
1 78
1 47
1 9
2 9
2 47
2 78
1 67
1 58
1 6
2 6
1 60
1 5
2 5
2 60
1 100
2 100
1 76
1 28
1 81
1 40
1 5
2 5
2 40
1 39
1 13
1 82
2 82
2 13
1 19
2 19
2 39
1 47
1 25
2 25
2 47
2 81
2 28
2 76
2 58
2 67
1 13
2 13
1 39
2 39
1 72
2 72
1 88
1 84
2 84
2 88
1 100
2 100
1 2
2 2
1 91
1 20
2 20
1 25
1 37
2 37...

output:

No
Yes
No
No

result:

ok 4 lines

Test #4:

score: 0
Accepted
time: 8ms
memory: 3852kb

input:

100000
1 99
1 79
2 79
1 90
2 90
2 99
1 43
1 40
1 61
2 40
2 43
2 61
1 98
1 70
1 65
2 65
2 70
2 98
1 64
2 64
1 64
1 12
1 57
1 54
1 69
1 19
1 67
1 99
1 42
1 25
1 88
2 12
2 19
1 50
1 45
1 60
1 55
1 14
1 49
1 55
2 14
1 87
2 25
1 14
2 14
1 37
1 20
2 20
2 37
2 42
2 45
2 49
1 82
1 39
1 80
1 76
1 7
2 7
1 19
...

output:

No
No
No
Yes

result:

ok 4 lines

Test #5:

score: 0
Accepted
time: 7ms
memory: 3592kb

input:

100000
1 83
2 83
1 84
1 49
1 12
1 29
2 84
2 49
1 3
2 29
2 12
2 3
1 24
1 46
1 13
2 46
2 24
2 13
1 66
1 92
2 92
2 66
1 37
1 50
1 16
1 90
2 90
1 92
2 92
1 38
2 50
1 24
1 85
1 13
2 85
2 38
1 53
1 46
1 7
1 43
1 16
1 28
2 53
1 56
1 59
2 59
2 56
2 46
2 43
1 31
1 64
1 3
2 64
1 46
2 46
2 37
2 31
1 71
2 71
1 ...

output:

No
No
Yes
No

result:

ok 4 lines

Test #6:

score: 0
Accepted
time: 6ms
memory: 3892kb

input:

100000
1 -2147483648
2 -2147483648
1 -2147483648
1 1
1 1
2 -2147483648
2 1
1 -2147483648
2 -2147483648
1 -1
1 1
2 -1
1 1
1 -2147483648
2 -2147483648
1 1
1 -2147483648
2 -2147483648
2 1
2 1
1 -1
2 -1
1 -1
2 -1
2 1
2 1
1 -2147483648
2 -2147483648
1 1
2 1
1 -1
2 -1
1 1
2 1
1 1
2 1
1 -2147483648
2 -2147...

output:

No
No
No
Yes

result:

ok 4 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

100000
1 1
2 1
1 1
2 1
2 1
1 1
1 1
1 1
1 1
1 1
1 1
2 1
2 1
1 1
2 1
2 1
1 1
2 1
2 1
1 1
1 1
2 1
1 1
2 1
2 1
2 1
1 1
1 1
1 1
2 1
2 1
1 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 1
1 1
1 1
1 1
1 1
1 1
2 1
2 1
2 1
2 1
1 1
1 1
2 1
2 1
2 1
1 1
1 1
1 1
2 1
1 1
2 1
1 1
1 1
1 1
2 1
1 1
2 1
2 1
2 1
1 1
1 1
2 1
1 1
1 1
2...

output:

No
No
No
No

result:

ok 4 lines