QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#578941 | #9313. Make Max | lxpyyds | WA | 1ms | 3536kb | C++14 | 778b | 2024-09-20 23:21:19 | 2024-09-20 23:21:19 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int op=0;
vector<int> dp(n+2);
dp[0]=INT_MAX;dp[n+1]=INT_MAX;
map<int,int> mp;
map<int,int> kp;
for(int i=1;i<=n;i++)
{
cin>>dp[i];
mp[dp[i]]=i;
kp[dp[i]]=1;
}
for (auto it = mp.begin(); it != mp.end(); ++it) {
if (next(it) == mp.end()) {
break;
}
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);
for(int i=1;i<=dp.size()-1;i++)
{
mp[dp[i]]=i;
}
}
cout<<op<<endl;
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3536kb
input:
4 2 1 2 2 2 2 7 1 1 1 2 2 2 2 3 1 2 3
output:
3 0 4 6
result:
wrong answer 1st numbers differ - expected: '1', found: '3'