QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#801190#9792. Ogre SortisWFnoya#WA 1ms5980kbC++20498b2024-12-06 19:13:542024-12-06 19:13:54

Judging History

This is the latest submission verdict.

  • [2024-12-06 19:13:54]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 5980kb
  • [2024-12-06 19:13:54]
  • Submitted

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