QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#578345#9313. Make Maxyeah14WA 0ms3540kbC++14767b2024-09-20 18:27:032024-09-20 18:27:03

Judging History

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

  • [2024-09-20 18:27:03]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3540kb
  • [2024-09-20 18:27:03]
  • 提交

answer

#include <iostream>
#include <vector>
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 max_ops = 0;
        int current_max = a[0];
        int current_min = a[0];
        int current_ops = 0;

        for (int i = 1; i < n; i++) {
            if (a[i] > current_max) {
                current_max = a[i];
                current_ops++;
            } else if (a[i] < current_min) {
                current_min = a[i];
                current_ops++;
            }
        }

        max_ops = current_ops;
        cout << max_ops << endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

1
0
1
2

result:

wrong answer 3rd numbers differ - expected: '3', found: '1'