QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#801190 | #9792. Ogre Sort | isWFnoya# | WA | 1ms | 5980kb | C++20 | 498b | 2024-12-06 19:13:54 | 2024-12-06 19:13:54 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int N=1919810;
int n,m;
int a[N],pos[N];
// map<int,int> flag,mp,ans;
int main()
{
cin>>n;
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
for(int i=1;i<=n;i++) pos[a[i]]=i;
int ans=n-1;
while(ans>0&&pos[ans]<pos[ans+1]) ans--;
cout<<ans<<" "<<ans<<endl;
int now=0;
for(int i=ans;i>0;i--){
printf("%d 1\n",now+pos[i]);
now++;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5956kb
input:
4 1 2 4 3
output:
3 3 4 1 3 1 3 1
result:
ok Participant's output is correct
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 5980kb
input:
5 2 4 1 3 5
output:
3 3 4 1 2 1 5 1
result:
wrong answer participant's moves don't sort the array