QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#809881#6506. Chase Game 3the_fool#WA 42ms3840kbC++20699b2024-12-11 18:02:052024-12-11 18:02:09

Judging History

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

  • [2024-12-11 18:02:09]
  • 评测
  • 测评结果:WA
  • 用时:42ms
  • 内存:3840kb
  • [2024-12-11 18:02:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using LL = long long;

void solve() {
    int n;
    cin>>n;
    vector<int> a(n+1);
    for (int i=1;i<=n;i++)cin>>a[i];
    if (n<=3) {
        cout<<"Yes"<<endl;
        return ;
    }
    for (int i=1;i<=n;i++) {
        if (a[i]==i)continue;
        if (a[i] != i+1 || a[i+1] != i-1) {
            cout<<"No"<<endl;
            return ;
        }
        if (i+2<=n && a[i+2]!=i+2) {
            cout<<"No"<<endl;
            return ;
        }
        i+=2;
    }
    cout<<"Yes"<<endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T;
    cin>>T;
    while (T--)solve();

}

详细

Test #1:

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

input:

5
2
1 2
3
2 3 1
4
1 4 3 2
5
1 5 2 3 4
6
1 2 3 4 5 6

output:

Yes
Yes
No
No
Yes

result:

ok 5 token(s): yes count is 3, no count is 2

Test #2:

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

input:

8
2
1 2
2
2 1
3
1 2 3
3
3 1 2
3
2 1 3
3
2 3 1
3
3 2 1
3
1 3 2

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 8 token(s): yes count is 8, no count is 0

Test #3:

score: -100
Wrong Answer
time: 42ms
memory: 3840kb

input:

100000
4
4 1 3 2
4
3 2 4 1
4
3 2 1 4
4
2 4 3 1
4
1 2 3 4
4
2 3 1 4
4
1 3 4 2
4
3 4 1 2
4
1 3 2 4
4
1 4 3 2
4
3 4 2 1
4
3 2 4 1
4
4 2 3 1
4
3 2 4 1
4
4 1 2 3
4
3 2 1 4
4
4 1 3 2
4
1 3 4 2
4
1 4 2 3
4
2 4 3 1
4
2 3 1 4
4
4 2 3 1
4
2 1 3 4
4
3 1 2 4
4
1 2 3 4
4
4 3 2 1
4
3 4 1 2
4
1 3 2 4
4
4 2 1 3
4
3...

output:

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

result:

wrong answer expected YES, found NO [1st token]