QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#792186#9274. Hungry Cannibalsbulijiojiodibuliduo#AC ✓1ms3944kbC++171.1kb2024-11-29 04:02:292024-11-29 04:02:31

Judging History

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

  • [2024-11-29 04:02:31]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3944kb
  • [2024-11-29 04:02:29]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

bool solve() {
	int a,b,x,y;
	scanf("%d%d%d%d",&a,&x,&b,&y);
	if (x+y==0) return false;
	if (a==0) return true;
	if (a+b<=2) return true;
	if (b>=a+2) return true;
	if (b==a+1) {
		if (y==0) return a<=1;
		if (x==0) return a<=2;
		return true;
	}
	if (y==0) return false;
	if (x==0) return a<=2;
	return a<=3;
	//return a<=3;
}
int _;
int main() {
	for (scanf("%d",&_);_;_--) {
		puts(solve()?"Yes":"No");
	}
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3600kb

input:

4
2 0 2 1
1 1 4 0
2 1 2 0
3 1 3 1

output:

Yes
Yes
No
Yes

result:

ok 4 tokens

Test #2:

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

input:

6
0 0 1 0
1 0 1 0
1 1 1 0
0 0 1 1
1 0 1 1
1 1 1 1

output:

No
No
Yes
Yes
Yes
Yes

result:

ok 6 tokens

Test #3:

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

input:

24
0 0 1 0
1 0 1 0
1 1 1 0
0 0 1 1
1 0 1 1
1 1 1 1
0 0 2 0
1 0 2 0
1 1 2 0
2 0 2 0
2 1 2 0
2 2 2 0
0 0 2 1
1 0 2 1
1 1 2 1
2 0 2 1
2 1 2 1
2 2 2 1
0 0 2 2
1 0 2 2
1 1 2 2
2 0 2 2
2 1 2 2
2 2 2 2

output:

No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 24 tokens

Test #4:

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

input:

64
0 0 1 0
1 0 1 0
1 1 1 0
0 0 1 1
1 0 1 1
1 1 1 1
0 0 2 0
1 0 2 0
1 1 2 0
2 0 2 0
2 1 2 0
2 2 2 0
0 0 2 1
1 0 2 1
1 1 2 1
2 0 2 1
2 1 2 1
2 2 2 1
0 0 2 2
1 0 2 2
1 1 2 2
2 0 2 2
2 1 2 2
2 2 2 2
0 0 3 0
1 0 3 0
1 1 3 0
2 0 3 0
2 1 3 0
2 2 3 0
3 0 3 0
3 1 3 0
3 2 3 0
3 3 3 0
0 0 3 1
1 0 3 1
1 1 3 1
2...

output:

No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes

result:

ok 64 tokens

Test #5:

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

input:

139
0 0 1 0
1 0 1 0
1 1 1 0
0 0 1 1
1 0 1 1
1 1 1 1
0 0 2 0
1 0 2 0
1 1 2 0
2 0 2 0
2 1 2 0
2 2 2 0
0 0 2 1
1 0 2 1
1 1 2 1
2 0 2 1
2 1 2 1
2 2 2 1
0 0 2 2
1 0 2 2
1 1 2 2
2 0 2 2
2 1 2 2
2 2 2 2
0 0 3 0
1 0 3 0
1 1 3 0
2 0 3 0
2 1 3 0
2 2 3 0
3 0 3 0
3 1 3 0
3 2 3 0
3 3 3 0
0 0 3 1
1 0 3 1
1 1 3 1
...

output:

No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
No
No
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes...

result:

ok 139 tokens

Test #6:

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

input:

265
0 0 1 0
1 0 1 0
1 1 1 0
0 0 1 1
1 0 1 1
1 1 1 1
0 0 2 0
1 0 2 0
1 1 2 0
2 0 2 0
2 1 2 0
2 2 2 0
0 0 2 1
1 0 2 1
1 1 2 1
2 0 2 1
2 1 2 1
2 2 2 1
0 0 2 2
1 0 2 2
1 1 2 2
2 0 2 2
2 1 2 2
2 2 2 2
0 0 3 0
1 0 3 0
1 1 3 0
2 0 3 0
2 1 3 0
2 2 3 0
3 0 3 0
3 1 3 0
3 2 3 0
3 3 3 0
0 0 3 1
1 0 3 1
1 1 3 1
...

output:

No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
No
No
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes...

result:

ok 265 tokens

Test #7:

score: 0
Accepted
time: 1ms
memory: 3940kb

input:

461
0 0 1 0
1 0 1 0
1 1 1 0
0 0 1 1
1 0 1 1
1 1 1 1
0 0 2 0
1 0 2 0
1 1 2 0
2 0 2 0
2 1 2 0
2 2 2 0
0 0 2 1
1 0 2 1
1 1 2 1
2 0 2 1
2 1 2 1
2 2 2 1
0 0 2 2
1 0 2 2
1 1 2 2
2 0 2 2
2 1 2 2
2 2 2 2
0 0 3 0
1 0 3 0
1 1 3 0
2 0 3 0
2 1 3 0
2 2 3 0
3 0 3 0
3 1 3 0
3 2 3 0
3 3 3 0
0 0 3 1
1 0 3 1
1 1 3 1
...

output:

No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
No
No
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes...

result:

ok 461 tokens

Test #8:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

1000
0 0 3 1
1 0 3 1
0 0 3 0
0 0 6 1
0 0 7 2
4 2 4 2
0 0 7 4
2 0 5 4
1 1 2 1
0 0 2 2
4 4 5 2
0 0 1 0
4 1 5 0
4 3 4 1
4 0 4 3
0 0 4 0
1 1 3 1
2 1 2 1
1 1 2 0
0 0 3 0
0 0 7 2
3 2 4 1
6 1 7 1
1 1 1 0
1 1 4 0
0 0 4 1
0 0 4 3
5 5 7 2
2 1 3 2
0 0 7 1
0 0 5 0
1 1 4 4
2 2 3 0
0 0 3 3
2 1 4 1
4 0 4 2
2 0 4 1...

output:

Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
No
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
No
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
No
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Ye...

result:

ok 1000 tokens

Test #9:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

1000
2 1 4 1
1 1 4 0
5 0 8 4
0 0 3 0
6 0 7 7
3 1 3 0
0 0 1 0
1 1 1 0
0 0 3 3
1 0 4 1
4 2 8 0
7 0 7 1
0 0 2 1
0 0 8 1
1 0 2 0
1 1 3 2
4 2 6 5
0 0 8 1
2 1 4 0
4 2 4 4
5 1 5 5
0 0 2 1
0 0 2 0
5 1 5 0
6 1 6 0
3 3 3 2
6 2 7 2
0 0 4 0
5 3 7 0
3 2 3 2
2 1 2 2
1 0 7 0
1 0 2 2
0 0 3 1
1 1 3 0
1 0 3 2
7 2 8 2...

output:

Yes
Yes
Yes
No
No
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Ye...

result:

ok 1000 tokens

Test #10:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

1000
7 3 8 8
3 3 3 2
1 1 1 1
1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yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Y...

result:

ok 1000 tokens

Test #12:

score: 0
Accepted
time: 1ms
memory: 3928kb

input:

1000
10 2 13 11
4 2 4 4
3 0 11 4
0 0 13 1
2 1 4 1
14 1 14 2
3 2 3 3
9 2 12 0
1 0 2 0
2 1 2 0
7 2 9 5
0 0 19 2
1 1 1 0
15 14 18 18
0 0 3 3
0 0 3 1
0 0 2 0
13 2 17 0
0 0 1 1
1 1 1 0
3 2 3 3
1 0 4 1
4 2 6 2
0 0 3 3
0 0 2 2
17 2 19 5
0 0 3 3
0 0 1 1
1 0 3 0
1 1 4 0
1 0 3 1
17 0 18 2
1 0 4 3
0 0 2 2
0 0 ...

output:

Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
...

result:

ok 1000 tokens

Test #13:

score: 0
Accepted
time: 1ms
memory: 3936kb

input:

1000
1 1 3 3
2 1 3 0
0 0 2 1
30 2 33 2
21 0 24 0
2 0 3 0
2 1 3 0
41 0 50 0
34 0 37 2
44 13 45 33
1 0 4 1
1 1 2 0
39 0 42 2
2 0 2 2
1 0 2 2
1 0 2 2
20 2 46 2
26 0 28 2
0 0 1 0
2 2 4 1
24 19 27 8
43 1 46 0
2 0 2 1
0 0 3 0
0 0 3 2
2 1 45 1
1 1 1 0
36 0 38 10
0 0 3 0
27 23 47 1
43 40 44 0
0 0 1 1
0 0 2 ...

output:

Yes
No
Yes
Yes
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
No
No
Yes
Yes
No
No
Yes
No
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
No
...

result:

ok 1000 tokens

Test #14:

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

input:

1000
0 0 2 1
0 0 1 0
3 0 3 3
2 1 4 2
0 0 3 0
3 2 3 1
2 0 3 3
2 2 96 1
82 1 84 0
2 1 100 1
1 0 4 1
2 2 4 2
1 1 2 1
4 1 4 1
1 1 3 3
1 1 4 0
3 1 3 0
25 0 75 5
2 1 3 0
38 36 62 0
59 1 61 34
0 0 1 1
0 0 2 1
1 0 1 0
3 3 4 4
1 1 4 0
1 0 3 1
2 1 3 0
1 1 88 1
29 5 93 0
23 4 85 1
3 0 4 0
1 0 2 2
2 2 4 3
2 0 4...

output:

Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes...

result:

ok 1000 tokens

Test #15:

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

input:

1000
81 24 157 2
1 1 4 1
0 0 3 3
18 0 184 0
3 1 4 4
2 2 4 1
2 1 3 1
4 3 4 2
1 1 3 0
0 0 2 2
74 0 74 2
1 1 4 4
2 0 4 1
32 0 35 2
36 1 109 0
0 0 1 1
31 2 32 0
15 2 143 2
1 0 3 3
0 0 2 1
3 0 4 1
1 0 3 1
3 1 4 0
2 0 2 1
1 1 4 2
4 4 4 0
74 1 77 23
1 0 2 0
1 1 2 0
0 0 3 1
1 1 3 3
0 0 1 1
0 0 3 3
151 0 152...

output:

Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 1000 tokens

Test #16:

score: 0
Accepted
time: 1ms
memory: 3928kb

input:

1000
1 0 3 3
4 0 4 0
210 0 270 30
3 0 4 2
2 2 2 1
157 1 159 103
1 0 4 3
3 1 4 4
1 1 3 2
212 152 214 197
96 43 261 1
1 1 2 0
1 0 2 0
273 0 276 2
7 2 469 1
475 2 478 420
0 0 1 1
2 1 4 1
2 1 4 0
1 0 3 2
20 1 361 2
1 0 1 1
298 226 455 2
16 1 434 229
1 1 4 4
119 47 390 0
3 1 3 1
1 0 2 1
0 0 1 0
27 2 29 2...

output:

Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes...

result:

ok 1000 tokens

Test #17:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

1000
1 1 3 1
450 432 453 2
0 0 3 1
167 1 857 1
4 4 4 2
2 2 4 2
2 1 2 1
1 0 1 0
3 0 3 1
812 0 815 1
644 1 647 1
0 0 3 0
2 1 4 2
1 1 4 0
3 2 3 3
2 2 4 4
90 1 953 1
0 0 3 3
1 0 2 2
0 0 1 0
0 0 1 1
4 2 4 2
0 0 3 0
0 0 1 0
2 1 4 2
1 0 3 3
0 0 1 1
450 183 453 239
1 0 4 3
660 0 976 1
3 0 3 1
186 1 187 109
...

output:

Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
No
No
No
No
No
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
N...

result:

ok 1000 tokens

Extra Test:

score: 0
Extra Test Passed