QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#689255#9313. Make Max202314170131WA 0ms3632kbC++14629b2024-10-30 16:03:152024-10-30 16:03:17

Judging History

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

  • [2024-10-30 16:03:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3632kb
  • [2024-10-30 16:03:15]
  • 提交

answer

#include <iostream>
#include <vector>
using namespace std;
 
void readCase(){
    int n;
    cin>>n;
    vector<int>m(n);
    for(int i=0;i<n;i++){
        cin>>m[i];
    }
    vector<int>a(n),b(n);
    a[0]=m[0];
    for(int i=1;i<n;i++){
        a[i]=max(a[i-1],m[i]);
    }
    b[n-1]=m[n-1];
    for(int i=n-2;i>=0;i--){
        b[i]=max(b[i+1],m[i]);
    }
    
    int maxps=0;
    for(int i=0;i<n;++i){
        if(a[i]!=b[i]){
            maxps++;
        }
    }
    cout<<maxps<<endl;
}
   
int main(){
    int t;
    cin>>t;
    while(t--){
        readCase();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

1
0
3
2

result:

wrong answer 4th numbers differ - expected: '3', found: '2'