QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#464519#2526. Imprecise ComputerKryptonKAC ✓39ms7112kbC++20577b2024-07-06 11:12:582024-07-06 11:12:58

Judging History

This is the latest submission verdict.

  • [2024-07-06 11:12:58]
  • Judged
  • Verdict: AC
  • Time: 39ms
  • Memory: 7112kb
  • [2024-07-06 11:12:58]
  • Submitted

answer

#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
using LL = long long;

void O_o() {
	int n;
	cin >> n;
	
	vector<int> d(n);
	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}

	int x = 0;
	for (auto u : d) {
		if (u == 1) {
			x ^= 1;
		} else if(u == 2) {
			if (!x) {
				cout << "NO\n";
				return;
			}
		}
	}
	if (x) {
		cout << "NO\n";
	} else {
		cout << "YES\n";
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int t = 1;
			
	while (t--) {
		O_o();
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

10
1 2 3 3 3 3 2 1 2 2

output:

NO

result:

ok single line: 'NO'

Test #2:

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

input:

10
0 0 0 0 0 0 0 0 0 1

output:

NO

result:

ok single line: 'NO'

Test #3:

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

input:

10
0 1 0 1 0 1 0 1 0 1

output:

NO

result:

ok single line: 'NO'

Test #4:

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

input:

10
1 0 1 0 1 0 1 0 1 0

output:

NO

result:

ok single line: 'NO'

Test #5:

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

input:

10
1 2 2 2 2 2 2 2 0 1

output:

YES

result:

ok single line: 'YES'

Test #6:

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

input:

10
1 2 2 2 2 2 2 2 0 0

output:

NO

result:

ok single line: 'NO'

Test #7:

score: 0
Accepted
time: 34ms
memory: 7000kb

input:

1000000
0 1 2 1 0 1 2 1 0 1 1 1 0 0 1 0 1 1 1 0 1 0 0 0 0 1 1 1 1 0 1 0 1 0 1 1 0 1 2 0 0 1 1 2 2 0 2 0 2 1 1 0 2 2 0 0 2 1 0 0 0 1 0 2 1 1 1 0 1 0 1 1 1 0 1 1 1 2 1 0 0 0 1 0 1 0 0 1 0 1 1 0 1 1 0 2 2 1 1 0 2 0 2 2 1 1 1 0 1 2 1 0 1 0 1 0 0 1 1 0 0 1 2 0 2 1 1 1 0 1 0 1 0 0 0 0 0 1 2 1 1 0 0 1 0 1 ...

output:

NO

result:

ok single line: 'NO'

Test #8:

score: 0
Accepted
time: 39ms
memory: 7000kb

input:

1000000
1 0 0 0 2 0 2 2 1 1 0 2 0 0 0 1 0 1 1 1 2 2 2 2 1 0 0 1 2 1 1 0 0 0 2 0 0 0 2 2 2 1 1 0 0 0 0 1 0 0 0 0 1 1 0 1 1 0 0 1 0 0 2 1 1 1 0 0 0 1 2 2 0 0 0 0 2 2 2 1 1 0 0 1 0 1 1 1 0 2 1 1 0 2 1 1 1 1 1 0 0 0 1 2 1 1 1 1 1 0 1 2 2 0 2 1 1 0 2 0 0 1 1 2 2 2 0 1 1 2 0 0 0 0 1 0 0 0 0 1 0 0 1 0 1 2 ...

output:

NO

result:

ok single line: 'NO'

Test #9:

score: 0
Accepted
time: 34ms
memory: 7000kb

input:

1000000
1 2 0 0 0 1 1 1 0 1 2 2 2 0 0 1 0 1 2 1 0 0 0 0 0 1 1 1 0 1 0 1 1 1 2 0 1 0 1 1 1 0 2 2 2 1 0 1 1 1 2 2 0 0 0 0 0 0 2 0 0 1 0 0 1 2 0 2 0 1 0 0 1 1 0 1 1 0 1 0 2 2 0 1 0 0 0 0 0 1 1 1 0 2 0 2 2 0 1 1 0 1 0 1 1 0 0 1 0 0 0 2 2 2 1 0 1 2 1 1 0 0 2 0 1 1 2 2 2 1 1 0 2 1 0 1 1 0 1 1 0 0 1 0 2 0 ...

output:

YES

result:

ok single line: 'YES'

Test #10:

score: 0
Accepted
time: 38ms
memory: 7032kb

input:

1000000
0 0 0 0 0 1 2 2 2 1 1 1 0 1 0 2 1 0 0 1 0 1 0 0 0 1 0 0 1 0 0 0 1 2 0 2 2 2 0 0 0 0 0 2 0 1 0 1 0 2 0 0 2 2 2 0 1 0 1 0 0 0 2 0 0 1 0 0 1 1 1 0 1 1 0 2 1 1 2 1 1 1 1 2 1 1 0 0 1 0 1 2 2 1 0 0 0 0 1 0 1 1 0 2 1 1 2 1 1 1 0 0 1 2 2 1 1 1 1 0 2 2 2 2 1 1 2 1 0 0 1 1 1 2 1 1 2 1 0 0 0 0 0 0 0 1 ...

output:

NO

result:

ok single line: 'NO'

Test #11:

score: 0
Accepted
time: 34ms
memory: 7048kb

input:

1000000
1 1 1 0 2 2 2 0 0 1 0 0 0 1 0 1 0 1 0 1 1 2 0 2 2 0 0 1 1 0 2 1 0 1 0 1 0 1 0 2 2 0 1 0 1 0 2 1 0 0 0 0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 1 1 0 1 1 1 1 1 0 0 1 1 1 2 0 1 0 0 1 0 1 1 1 1 0 1 0 1 2 0 2 1 0 1 0 1 0 0 0 1 0 1 1 0 1 0 0 0 1 1 0 0 1 0 2 1 1 0 1 0 1 1 0 1 1 0 1 0 0 1 0 1 2 2 2 2 1 1 2 0 ...

output:

YES

result:

ok single line: 'YES'

Test #12:

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

input:

10
2 1 1 1 1 1 1 1 1 1

output:

NO

result:

ok single line: 'NO'

Test #13:

score: 0
Accepted
time: 35ms
memory: 7036kb

input:

1000000
1 2 0 0 1 1 1 0 1 2 1 0 0 1 0 1 0 1 2 2 0 0 1 1 0 1 1 2 0 1 0 1 0 2 2 2 2 0 2 0 2 1 1 0 1 1 1 0 1 0 0 2 1 0 0 1 1 0 1 0 1 1 2 0 1 1 0 1 0 0 1 1 0 1 2 0 0 1 0 0 1 1 0 0 1 2 1 0 0 0 0 1 1 1 0 1 1 1 1 0 0 2 0 0 2 1 0 1 1 0 0 1 1 1 0 0 1 1 2 1 1 1 1 0 2 0 1 1 1 0 0 0 0 0 0 1 2 1 1 0 2 1 0 0 1 0 ...

output:

YES

result:

ok single line: 'YES'

Test #14:

score: 0
Accepted
time: 34ms
memory: 6952kb

input:

1000000
1 0 0 0 2 0 0 1 1 1 1 0 1 1 0 1 0 1 0 1 1 0 0 1 1 1 0 1 1 0 1 2 0 1 0 0 0 1 2 0 1 1 2 1 1 0 1 1 2 2 1 1 2 2 1 0 1 1 1 0 0 2 2 2 1 0 1 2 2 0 0 0 1 1 1 0 0 0 0 1 0 0 0 2 1 1 1 1 0 1 1 2 0 1 1 0 1 1 2 2 2 0 2 1 1 1 1 2 1 0 1 1 0 1 0 1 1 0 0 2 0 0 0 2 2 0 2 1 1 0 0 2 1 1 2 1 0 1 1 1 1 0 1 0 0 0 ...

output:

NO

result:

ok single line: 'NO'

Test #15:

score: 0
Accepted
time: 27ms
memory: 7108kb

input:

1000000
1 2 2 0 0 1 0 1 2 1 1 0 2 1 0 1 1 1 1 0 1 1 0 0 1 0 2 1 1 1 1 1 0 1 1 1 0 1 0 0 0 1 2 0 1 0 1 2 1 1 0 0 0 1 1 2 0 1 1 2 1 0 1 0 0 2 1 0 1 1 1 1 1 2 0 0 2 1 1 2 1 1 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 0 1 2 0 0 0 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 1 1 2 0 1 0 0 0 1 1 1 0 0 2 1 0 0 1 0 0 ...

output:

NO

result:

ok single line: 'NO'

Test #16:

score: 0
Accepted
time: 34ms
memory: 7048kb

input:

1000000
1 0 2 0 1 1 2 0 1 0 0 1 0 2 0 1 0 1 2 2 1 1 0 2 1 1 2 0 1 1 0 1 1 2 0 2 1 0 0 1 1 1 0 1 0 0 0 0 0 0 1 0 2 2 0 0 2 0 2 1 0 1 0 0 2 0 1 0 1 0 2 0 1 1 1 0 1 1 1 1 0 1 0 0 0 2 1 0 1 1 0 0 1 0 0 2 0 1 1 0 0 1 0 0 0 1 2 2 2 2 2 0 0 2 0 0 0 0 2 0 0 0 0 1 0 1 0 1 0 1 1 0 1 2 2 0 1 0 0 0 0 0 1 0 0 0 ...

output:

YES

result:

ok single line: 'YES'

Test #17:

score: 0
Accepted
time: 26ms
memory: 6964kb

input:

1000000
1 2 1 0 0 1 2 0 1 0 1 0 2 0 0 1 0 1 1 0 1 2 2 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 1 2 1 0 1 0 2 0 2 0 2 2 0 0 1 0 1 1 0 0 1 1 0 1 1 1 1 1 2 2 2 0 1 0 0 0 1 0 0 0 1 1 2 0 1 0 1 0 2 0 2 0 0 1 0 1 1 0 0 1 0 2 0 1 0 0 1 2 2 1 1 1 0 1 1 1 2 1 0 1 1 1 2 0 2 1 0 1 2 2 1 1 1 1 2 0 2 0 1 1 0 1 0 0 1 0 0 ...

output:

NO

result:

ok single line: 'NO'

Test #18:

score: 0
Accepted
time: 34ms
memory: 7044kb

input:

1000000
1 1 1 0 0 2 2 2 1 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 1 2 0 1 0 0 1 2 0 0 1 1 0 0 0 1 1 1 0 0 1 0 2 0 1 0 0 1 2 0 1 1 1 0 1 1 0 0 1 0 2 0 2 0 1 0 1 1 0 1 0 2 0 2 0 2 1 0 1 2 2 1 0 1 0 0 0 2 2 0 0 0 0 1 1 1 1 1 1 0 0 0 2 0 0 0 2 2 2 1 1 0 0 1 1 2 0 0 0 0 0 2 1 1 1 1 2 2 0 1 1 2 2 2 0 1 0 1 2 0 0 ...

output:

NO

result:

ok single line: 'NO'

Test #19:

score: 0
Accepted
time: 31ms
memory: 7112kb

input:

1000000
1 2 2 1 1 1 0 0 1 2 1 0 0 1 2 0 1 1 0 2 1 0 1 2 2 2 1 1 1 0 0 0 1 0 0 0 0 1 1 2 2 2 2 0 2 1 1 0 0 1 0 1 2 2 1 1 1 1 2 2 0 1 0 0 0 1 2 1 0 1 1 1 1 0 0 0 1 0 2 1 0 1 2 1 0 0 0 1 1 1 1 1 1 0 0 0 1 2 2 1 0 1 1 0 0 1 2 0 1 1 2 2 1 0 0 0 0 0 0 0 1 0 2 0 0 1 0 0 0 0 0 1 2 1 0 0 0 0 1 1 0 1 1 1 1 0 ...

output:

NO

result:

ok single line: 'NO'

Test #20:

score: 0
Accepted
time: 34ms
memory: 7012kb

input:

1000000
1 1 1 1 0 1 0 1 1 2 0 1 1 2 2 2 1 1 1 1 0 0 2 1 1 1 1 1 0 0 0 0 1 2 2 0 1 1 1 0 1 1 1 2 2 2 1 0 1 2 0 2 0 1 0 1 0 1 0 0 1 2 2 0 2 1 0 0 0 1 2 1 0 1 0 0 0 0 2 1 1 2 2 2 2 0 0 1 1 1 1 2 2 0 1 1 1 1 0 0 0 0 2 0 0 1 0 1 0 0 1 1 1 0 0 1 2 2 1 1 1 1 2 1 1 0 1 0 0 1 2 2 0 2 0 0 1 0 1 0 0 2 1 0 0 1 ...

output:

NO

result:

ok single line: 'NO'

Test #21:

score: 0
Accepted
time: 33ms
memory: 6980kb

input:

1000000
1 0 1 1 0 2 0 1 0 0 1 1 1 0 2 2 2 0 2 2 2 1 0 1 0 0 0 0 1 1 1 1 0 1 1 2 2 2 2 1 1 0 0 0 2 2 1 0 0 0 1 2 2 2 0 1 1 0 1 0 1 0 1 1 1 1 1 0 0 1 0 2 1 1 2 2 2 0 1 1 1 0 0 1 2 0 1 1 0 0 0 0 2 1 0 1 2 2 0 2 2 2 2 1 0 1 0 0 2 2 0 1 0 1 1 1 1 1 0 2 1 0 1 2 1 1 0 0 2 1 1 0 2 0 1 1 0 0 0 2 0 0 1 0 0 1 ...

output:

NO

result:

ok single line: 'NO'

Test #22:

score: 0
Accepted
time: 30ms
memory: 7036kb

input:

1000000
1 2 1 0 0 0 0 0 1 2 2 1 1 1 1 2 0 2 0 1 1 2 0 2 0 2 0 1 0 0 0 1 1 1 1 0 1 2 0 0 0 2 0 2 1 1 1 1 1 1 2 2 0 0 2 2 1 1 2 2 1 0 1 0 0 0 0 0 1 1 1 1 2 0 1 0 1 0 1 0 1 0 2 0 1 1 0 0 1 0 0 1 2 2 2 2 0 0 1 1 1 0 0 1 2 1 1 0 0 1 0 0 1 2 0 1 1 2 0 0 1 1 2 0 0 0 2 2 1 0 1 0 1 0 1 2 2 2 2 2 2 1 0 0 0 0 ...

output:

NO

result:

ok single line: 'NO'

Test #23:

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

input:

10
1 1 1 1 1 1 1 1 1 2

output:

NO

result:

ok single line: 'NO'

Test #24:

score: 0
Accepted
time: 35ms
memory: 7020kb

input:

1000000
1 0 0 1 1 0 0 0 1 1 1 0 0 0 1 2 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 0 1 2 1 0 0 1 1 1 2 1 1 0 1 1 0 1 1 2 2 2 2 2 0 0 0 2 0 0 1 1 2 1 0 1 0 0 2 0 2 2 0 0 0 1 0 1 0 2 1 0 0 0 1 2 2 0 2 2 2 0 0 0 1 1 1 0 1 1 0 1 0 2 2 1 0 1 2 0 1 0 0 1 2 1 0 0 0 0 1 0 2 2 2 1 1 0 0 0 2 1 1 1 1 1 0 1 1 1 2 2 1 0 0 1 ...

output:

NO

result:

ok single line: 'NO'

Test #25:

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

input:

10
1 2 2 2 2 2 2 2 2 0

output:

NO

result:

ok single line: 'NO'

Test #26:

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

input:

10
1 2 2 2 2 2 2 2 2 1

output:

YES

result:

ok single line: 'YES'

Test #27:

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

input:

10
1 1 1 1 1 1 1 1 1 1

output:

YES

result:

ok single line: 'YES'

Test #28:

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

input:

9
1 1 1 1 1 1 1 1 1

output:

NO

result:

ok single line: 'NO'

Test #29:

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

input:

10
0 0 0 0 0 0 0 0 0 0

output:

YES

result:

ok single line: 'YES'

Test #30:

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

input:

10
0 0 0 0 0 0 0 0 1 1

output:

YES

result:

ok single line: 'YES'

Test #31:

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

input:

5
1 0 2 0 1

output:

YES

result:

ok single line: 'YES'

Test #32:

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

input:

5
1 1 2 1 0

output:

NO

result:

ok single line: 'NO'