QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#773569#9792. Ogre Sortucup-team2279#WA 1ms5708kbC++20504b2024-11-23 09:24:332024-11-23 09:24:38

Judging History

This is the latest submission verdict.

  • [2024-11-23 09:24:38]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 5708kb
  • [2024-11-23 09:24:33]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
const int N=3e5+5;
int n,j=1,a[N],b[N];
vector<array<int,2>> p;
long long s;
int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++){
		for(;j<=n&&a[j]<i;j++) p.push_back({i-1,b[a[j]]});
		if(i==a[j]) j++;
		else s+=b[i]=j;
	}
	for(;j<=n;j++) p.push_back({n,b[a[j]]});
	cout<<s<<" "<<p.size()<<"\n";
	reverse(begin(p),end(p));
	for(auto&x:p) cout<<x[0]<<" "<<x[1]<<"\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3676kb

input:

4
1 2 4 3

output:

3 1
4 3

result:

ok Participant's output is correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

5
2 4 1 3 5

output:

3 2
4 2
4 1

result:

ok Participant's output is correct

Test #3:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

3
1 2 3

output:

0 0

result:

ok Participant's output is correct

Test #4:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

4
1 2 4 3

output:

3 1
4 3

result:

ok Participant's output is correct

Test #5:

score: 0
Accepted
time: 1ms
memory: 5708kb

input:

5
2 4 1 3 5

output:

3 2
4 2
4 1

result:

ok Participant's output is correct

Test #6:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

3
1 2 3

output:

0 0

result:

ok Participant's output is correct

Test #7:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

1
1

output:

0 0

result:

ok Participant's output is correct

Test #8:

score: -100
Wrong Answer
time: 0ms
memory: 3648kb

input:

5
5 3 4 1 2

output:

4 4
5 1
5 1
5 1
5 1

result:

wrong answer participant's moves don't sort the array