QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#576821 | #9313. Make Max | lxpyyds | WA | 0ms | 3600kb | C++14 | 581b | 2024-09-19 22:44:01 | 2024-09-19 22:44:02 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
signed main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int op=0;
vector<int> dp(n);
map<int,int> mp;
map<int,int> kp;
for(int i=0;i<n;i++)
{
cin>>dp[i];
mp[dp[i]]=i;
kp[dp[i]]=1;
}
for (auto it = mp.begin(); it != mp.end(); ++it) {
int x=it->first;int y=it->second;
if(dp[y-1]<dp[y+1]){
kp[dp[y-1]]+=kp[dp[y]];
}else{
kp[dp[y+1]]+=kp[dp[y]];
}
op+=kp[dp[y]];
dp.erase(dp.begin()+y);
}
cout<<op<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3600kb
input:
4 2 1 2 2 2 2 7 1 1 1 2 2 2 2 3 1 2 3
output:
2 1 3 3
result:
wrong answer 1st numbers differ - expected: '1', found: '2'