QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#663586#6604. Kobolds and CatacombsDixiky_215WA 125ms15192kbC++20706b2024-10-21 16:19:572024-10-21 16:19:57

Judging History

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

  • [2024-10-21 16:19:57]
  • 评测
  • 测评结果:WA
  • 用时:125ms
  • 内存:15192kb
  • [2024-10-21 16:19:57]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
const int MAXN=2e6+7;       
const int ep=505;                                                  
int t;
int n;
int a[MAXN],c[MAXN];
int main()
{
    cin.tie(nullptr) ->sync_with_stdio(false);

    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i],c[i]=a[i];
    sort(c+1,c+1+n);
    int maxl=0,ans=0,pre_max=0;
    int minl=1e9+7;
    for(int i=1;i<=n;i++)
    {
        maxl=max(maxl,a[i]);
        minl=min(minl,a[i]);
        if(minl>=pre_max)
        {
            pre_max=maxl;
            maxl=0;minl=1e9+7;
            ans++;
        }
    }
    if(maxl>0) ans++;
    cout<<ans;
    return 0;
}
/*

*/

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5780kb

input:

5
1 3 2 7 4

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: -100
Wrong Answer
time: 125ms
memory: 15192kb

input:

1000000
524227301 431992275 758916082 293029389 719487809 413407585 7533705 414925441 87316769 639877621 980912701 739058961 277730843 958292661 778325685 500280161 782766985 339709027 1968001 842653531 847517701 989893001 97622801 728458741 612188545 787566057 981715521 281901909 804267925 89113887...

output:

2

result:

wrong answer 1st numbers differ - expected: '1', found: '2'