QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#216754 | #6604. Kobolds and Catacombs | wiseman123 | WA | 476ms | 58216kb | C++14 | 682b | 2023-10-15 22:15:32 | 2023-10-15 22:15:32 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <map>
const int maxn=1e6+10;
using namespace std;
int a[maxn],b[maxn];
map<int,int> mp;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
b[i]=a[i];
}
sort(b+1,b+1+n);
for(int i=1;i<=n;i++)
{
mp[b[i]]=i;
}
int l=1,r=0,ans=0;
for(int i=1;i<=n;i++)
{
if(i>r)
{
l=i;
ans++;
r=mp[a[i]];
}
else r=max(mp[a[i]],r);
if(r==n) break;
//cout<<r<<" "<<ans<<endl;
}
cout<<ans;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5724kb
input:
5 1 3 2 7 4
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 476ms
memory: 58216kb
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:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 418ms
memory: 58124kb
input:
1000000 917949585 857260961 756665311 378355301 764449441 412507811 172034129 259899788 32062001 770226301 952621053 541484449 569936821 627592441 215749889 859777895 354928623 873704001 816399789 991063481 915131641 712367896 390917421 345695004 999782016 716109223 361816825 689562663 101790565 284...
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: -100
Wrong Answer
time: 34ms
memory: 11488kb
input:
1000000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
1
result:
wrong answer 1st numbers differ - expected: '1000000', found: '1'