QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#662695 | #4831. Eager Sorting | N_z_ | 0 | 1ms | 3820kb | C++23 | 422b | 2024-10-21 09:19:03 | 2024-10-21 09:19:03 |
answer
#include<bits/stdc++.h>
using namespace std;
int a[101];
int main()
{
int n;
cin>>n;
for(int x=1;x<=n;x++)
a[x]=x;
stable_sort(a+1,a+1+n,[&](int a,int b){cout<<a<<' '<<b<<endl;int res;cin>>res;return res;});
for(int x=1;x<n;x++)
if(a[x]!=x)
{
for(int y=x+1;y<=n;y++)
if(a[y]==x)
{
cout<<a[x]<<' '<<x<<endl;
int res;
cin>>res;
swap(a[x],a[y]);
}
}
cout<<"-1 -1"<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3628kb
Interactor to First Run
5 0 0 1 1 1 0 0 0 -1
First Run to Interactor
2 1 2 1 3 1 5 4 4 2 4 1 5 1 3 1 3 2 5 3
Interactor to Second Run
5 0 0 0 1 0 0 0 0 0 0
Second Run to Interactor
2 1 2 1 3 1 3 2 3 1 5 4 5 4 5 2 4 2 3 2 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #2:
score: 100
Accepted
time: 1ms
memory: 3536kb
Interactor to First Run
1
First Run to Interactor
-1 -1
Interactor to Second Run
1
Second Run to Interactor
-1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #3:
score: 100
Accepted
time: 1ms
memory: 3640kb
Interactor to First Run
2 0
First Run to Interactor
2 1 -1 -1
Interactor to Second Run
2 0
Second Run to Interactor
2 1 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #4:
score: 100
Accepted
time: 1ms
memory: 3528kb
Interactor to First Run
2 1 0
First Run to Interactor
2 1 2 1 -1 -1
Interactor to Second Run
2 0
Second Run to Interactor
2 1 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #5:
score: 100
Accepted
time: 0ms
memory: 3624kb
Interactor to First Run
9 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0
First Run to Interactor
2 1 3 2 3 1 4 2 4 3 5 2 5 4 5 3 7 6 7 6 8 6 8 7 8 6 9 6 9 7 9 4 7 4 8 4 6 4 6 5 6 3 2 1 6 4 8 7 -1 -1
Interactor to Second Run
9 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1
Second Run to Interactor
2 1 2 1 3 1 3 2 4 1 5 4 5 3 7 6 8 7 8 6 9 7 8 5 6 5 7 5 9 5 4 1 4 2 4 3 9 6 9 8 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #6:
score: 100
Accepted
time: 1ms
memory: 3628kb
Interactor to First Run
9 0 0 1 1 1 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1
First Run to Interactor
2 1 2 1 3 1 4 3 5 4 7 6 7 6 8 6 8 7 9 6 8 2 7 2 7 1 6 1 9 1 5 1 4 2 5 4 9 5 9 8 -1 -1
Interactor to Second Run
9 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0
Second Run to Interactor
2 1 2 1 3 1 4 3 4 2 5 3 5 4 7 6 7 6 8 6 8 7 8 6 9 6 9 7 9 5 7 5 8 5 6 5 6 4 3 1 3 2 6 5 8 7 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #7:
score: 100
Accepted
time: 1ms
memory: 3640kb
Interactor to First Run
6 1 0 0 0 0 0 1 0 1 0 0 1 1 0 0 0
First Run to Interactor
2 1 3 2 3 1 5 4 5 4 6 4 6 5 6 4 4 2 6 2 6 1 6 3 5 3 4 1 4 3 6 4 -1 -1
Interactor to Second Run
6 1 1 1 0 0 0 0 0 0 0
Second Run to Interactor
2 1 3 2 5 4 6 5 6 4 5 3 5 2 5 1 3 1 5 4 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #8:
score: 0
Wrong Answer
time: 1ms
memory: 3820kb
Interactor to First Run
20 1 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 1 1 1 1 0 1 0 1 0 0 0
First Run to Interactor
2 1 3 2 4 3 5 4 6 5 6 1 7 5 9 8 9 8 10 8 10 9 10 8 8 7 10 7 10 5 10 4 10 3 10 2 10 1 10 6 9 6 12 11 12 11 13 11 14 13 14 12 15 13 16 15 17 16 19 18 20 19 20 17 20 16 20 15 20 13 20 11 20 12 20 14 17 8 16 8 15 8 15 7 13 7 13 5 13 4 13 3 13 2 11 2 11 1 11 10 12 10 12 9 14 9 14 6 17 1 16 2 8 3 15 4 7 5...
Interactor to Second Run
20 0 0 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 1 1
Second Run to Interactor
2 1 2 1 3 1 4 3 5 4 6 5 7 6 9 8 9 8 10 8 10 9 10 8 8 7 10 7 10 6 10 5 10 4 10 3 10 1 10 2 12 11 12 11 13 11 14 13 14 12 14 11 15 13 16 15 16 12 16 14 16 11 17 15 17 12 19 18 19 18 20 18 20 19 18 15 19 15 19 13 20 13 20 11 20 16 20 14 20 12 20 17 18 8 18 7 18 6 18 5 18 4 18 3 18 1 18 2 18 10 18 9 8 1...
Manager to Checker
WA array is not sorted!
result:
wrong answer WA