QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#575448 | #9313. Make Max | yylx | WA | 0ms | 3620kb | C++14 | 828b | 2024-09-19 14:24:29 | 2024-09-19 14:24:29 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'