QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#575448#9313. Make MaxyylxWA 0ms3620kbC++14828b2024-09-19 14:24:292024-09-19 14:24:29

Judging History

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

  • [2024-09-19 14:24:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2024-09-19 14:24:29]
  • 提交

answer

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
        }

        int operations = 0;
        bool canOperate = false;
        int maxElem = a[0];

        for (int i = 0; i < n; ++i) {
            if (a[i] > maxElem) {
                maxElem = a[i];
                canOperate = true;
            }
            if (i > 0 && a[i] != a[i - 1]) {
                operations++;
                canOperate = true;
            }
        }

        if (a[0] != a[n - 1] && canOperate) {
            operations++;
        }

        cout << operations << endl;
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3620kb

input:

4
2
1 2
2
2 2
7
1 1 1 2 2 2 2
3
1 2 3

output:

2
0
2
3

result:

wrong answer 1st numbers differ - expected: '1', found: '2'