QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#576305#9320. Find the Easiest Problem22333322WA 0ms4020kbC++14938b2024-09-19 19:51:592024-09-19 19:51:59

Judging History

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

  • [2024-09-19 19:51:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4020kb
  • [2024-09-19 19:51:59]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int mxn=2e5+5,inf=1e9+1;
#define int long long 
int a[mxn],t,n;
struct A
{
    int pre,num,size;
};
signed main()
{   
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld",&n);
        for(int i=1;i<=n;i++) scanf("%lld",a+i);a[++n]=1e9+1;
        stack<A>s;
        s.push({inf,inf,0});
        int ans=0,p=1;
        while(p<=n)
        {
            A &x=s.top();
            if(a[p]<x.num) s.push({x.num,a[p],1}),p++;
            else if(a[p]==x.num) x.size++,p++;
            else if(x.pre>a[p])
            {
                ans+=x.size;
                x={x.pre,a[p],++x.size};
                p++;
            }
            else if(x.pre<=a[p])
            {
                ans+=x.size;
                s.pop();
                s.top().size+=x.size;
            }
        }
        printf("%lld",ans-n+1);
    }
    return 0;
}

詳細信息

Test #1:

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

input:

2
5
teamA A accepted
teamB B rejected
teamC A accepted
teamB B accepted
teamD C accepted
4
teamA A rejected
teamB A accepted
teamC B accepted
teamC B accepted

output:

0-1

result:

wrong answer 1st lines differ - expected: 'A', found: '0-1'