QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#109637#6506. Chase Game 3YangHuanhuanWA 2ms3412kbC++14604b2023-05-30 00:15:162023-05-30 00:15:17

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-30 00:15:17]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3412kb
  • [2023-05-30 00:15:16]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int T; cin >> T;
    while (T--)
    {
        int n; cin >> n;
        vector<int> v(n + 1);
        for (int i = 1; i <= n; ++i) cin >> v[i];

        bool ok = true;
        for (int i = 1; i <= n; ++i)
        {
            if (abs(v[i] - v[i - 1]) > 2)
            {
                ok = false;
                break;
            }
        }
        if (ok) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3380kb

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: -100
Wrong Answer
time: 1ms
memory: 3412kb

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
No
Yes
Yes
No
Yes

result:

wrong answer expected YES, found NO [4th token]