QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#741093#2526. Imprecise ComputerNMK#AC ✓41ms7612kbC++17473b2024-11-13 13:19:172024-11-13 13:19:24

Judging History

This is the latest submission verdict.

  • [2024-11-13 13:19:24]
  • Judged
  • Verdict: AC
  • Time: 41ms
  • Memory: 7612kb
  • [2024-11-13 13:19:17]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
int n;
int a[1000005];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for(int i = 1;i <= n;i++) cin >> a[i];
    int x = 0;
    for(int i = 1;i <= n;i++) {
        if(x&&a[i]) a[i]--, x = 0;
        if(a[i]) {
            a[i]--;
            x = 1;
        }
        if(a[i]) {cout << "NO"; return 0;}
    }
    if(x) cout << "NO";
    else cout << "YES";
    return 0;
}

詳細信息

Test #1:

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

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: 3684kb

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: 3624kb

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: 3648kb

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: 3692kb

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: 7552kb

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: 38ms
memory: 7544kb

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: 7460kb

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: 34ms
memory: 7612kb

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: 41ms
memory: 7528kb

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: 3688kb

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: 34ms
memory: 7524kb

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: 29ms
memory: 7536kb

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: 33ms
memory: 7480kb

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: 38ms
memory: 7480kb

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: 29ms
memory: 7556kb

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: 33ms
memory: 7528kb

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: 33ms
memory: 7520kb

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: 29ms
memory: 7608kb

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: 22ms
memory: 7528kb

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: 33ms
memory: 7524kb

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: 3580kb

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: 26ms
memory: 7520kb

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: 3548kb

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: 3556kb

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: 3632kb

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: 3704kb

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: 3556kb

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: 3616kb

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: 3628kb

input:

5
1 0 2 0 1

output:

YES

result:

ok single line: 'YES'

Test #32:

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

input:

5
1 1 2 1 0

output:

NO

result:

ok single line: 'NO'