QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#376429#2526. Imprecise ComputerFOY#AC ✓91ms3692kbC++23351b2024-04-04 09:50:592024-04-04 09:51:00

Judging History

This is the latest submission verdict.

  • [2024-04-04 09:51:00]
  • Judged
  • Verdict: AC
  • Time: 91ms
  • Memory: 3692kb
  • [2024-04-04 09:50:59]
  • Submitted

answer

#include <iostream>
using namespace std;

int main() {
    int n; cin >> n;
    int car = 0;
    bool bad = false;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        x -= car;
        car = abs(x);
        if (car > 1) bad = true;
    }
    if (car == 0 && !bad) cout << "YES" << endl;
    else cout << "NO" << endl;
}

詳細信息

Test #1:

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

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

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

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

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

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

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: 88ms
memory: 3604kb

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: 83ms
memory: 3688kb

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: 91ms
memory: 3556kb

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: 86ms
memory: 3492kb

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: 87ms
memory: 3628kb

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

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: 87ms
memory: 3608kb

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: 83ms
memory: 3532kb

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: 87ms
memory: 3616kb

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: 89ms
memory: 3668kb

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: 87ms
memory: 3688kb

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: 87ms
memory: 3668kb

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: 88ms
memory: 3588kb

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: 83ms
memory: 3508kb

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: 87ms
memory: 3532kb

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: 87ms
memory: 3600kb

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

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: 87ms
memory: 3532kb

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

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

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

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

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

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

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

input:

5
1 0 2 0 1

output:

YES

result:

ok single line: 'YES'

Test #32:

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

input:

5
1 1 2 1 0

output:

NO

result:

ok single line: 'NO'