QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#662776 | #4831. Eager Sorting | rotcar07 | 0 | 1ms | 3740kb | C++23 | 682b | 2024-10-21 10:15:47 | 2024-10-21 10:15:47 |
answer
#include<bits/stdc++.h>
using namespace std;
int b[105];
int main(){
int n;cin>>n;
for(int i=1;i<=n;i++){
int l=1,r=i,pos=i;
while(l<r){
int mid=l+r>>1;
cout<<pos<<' '<<mid<<endl;
int z;cin>>z;
int zz=z^(pos>mid);
if(z) swap(b[mid],b[pos]),pos=mid;
if(zz) l=mid+1;
else r=mid;
}
for(int j=1;j<=i;j++) if(b[j]>=r) b[j]++;
b[pos]=r;
}
for(int i=1;i<=n;i++){
if(b[i]!=i){
int z;cout<<b[i]<<' '<<i<<endl;
cin>>z;
swap(b[b[i]],b[i]);
}
}
cout<<"-1 -1"<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3660kb
Interactor to First Run
5 0 1 1 0 0 1 0 1 -1
First Run to Interactor
2 1 3 2 2 1 4 2 4 3 5 3 3 2 5 4 -1 -1
Interactor to Second Run
5 0 0 0 0 0 0
Second Run to Interactor
2 1 3 2 4 2 4 3 5 3 5 4 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #2:
score: 100
Accepted
time: 1ms
memory: 3716kb
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: 3668kb
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: 3636kb
Interactor to First Run
2 1
First Run to Interactor
2 1 -1 -1
Interactor to Second Run
2 0 -1
Second Run to Interactor
2 1 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #5:
score: 100
Accepted
time: 1ms
memory: 3740kb
Interactor to First Run
9 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 0 0
First Run to Interactor
2 1 3 2 4 2 4 3 5 3 5 4 6 3 3 2 2 1 7 4 7 6 8 4 8 6 8 7 9 5 5 3 5 4 6 4 8 7 7 9 -1 -1
Interactor to Second Run
9 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1
Second Run to Interactor
2 1 3 2 4 2 4 3 5 3 5 4 6 3 6 5 5 4 7 4 7 6 6 5 8 4 8 6 8 7 9 5 9 7 9 8 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #6:
score: 100
Accepted
time: 1ms
memory: 3736kb
Interactor to First Run
9 0 1 1 1 1 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 1
First Run to Interactor
2 1 3 2 2 1 4 2 2 1 5 3 3 2 6 3 6 5 5 4 7 4 7 6 6 5 8 4 8 6 8 7 9 5 5 3 5 4 7 6 9 8 -1 -1
Interactor to Second Run
9 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1
Second Run to Interactor
2 1 3 2 4 2 4 3 5 3 5 4 6 3 6 5 7 4 7 6 8 4 8 6 6 5 9 5 9 7 9 8 8 7 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #7:
score: 100
Accepted
time: 1ms
memory: 3736kb
Interactor to First Run
6 1 0 1 1 1 0 1 1 0 0 1
First Run to Interactor
2 1 3 2 4 2 2 1 5 3 3 2 6 3 3 2 2 1 5 4 4 6 -1 -1
Interactor to Second Run
6 0 0 0 0 0 0 0 1 0
Second Run to Interactor
2 1 3 2 4 2 4 3 5 3 5 4 6 3 6 5 5 4 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #8:
score: 100
Accepted
time: 1ms
memory: 3712kb
Interactor to First Run
20 1 1 0 1 1 1 1 0 0 0 1 0 1 1 0 1 0 0 0 1 0 0 1 0 0 0 1 0 1 0 1 0 0 1 0 0 0 1 1 1 1 1 1 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1
First Run to Interactor
2 1 3 2 2 1 4 2 2 1 5 3 3 2 2 1 6 3 6 5 7 4 4 2 4 3 8 4 4 2 4 3 9 5 9 7 9 8 10 5 5 3 5 4 11 6 6 3 6 5 12 6 12 9 9 8 13 7 7 4 7 6 6 5 14 7 14 11 11 9 11 10 15 8 15 12 12 10 10 9 16 8 8 4 4 2 2 1 17 9 9 5 5 3 3 2 2 1 18 9 18 14 18 16 18 17 19 10 10 5 5 3 3 2 2 1 20 10 20 15 15 13 13 12 12 11 5 4 9 6 1...
Interactor to Second Run
20 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1
Second Run to Interactor
2 1 3 2 4 2 4 3 5 3 5 4 6 3 6 5 7 4 7 6 6 5 8 4 8 6 8 7 9 5 9 7 9 8 10 5 10 8 10 9 11 6 11 9 9 8 8 7 12 6 12 9 9 8 8 7 13 7 13 10 10 9 14 7 14 11 14 13 15 8 15 12 15 14 16 8 16 12 16 14 16 15 17 9 17 13 17 15 15 14 18 9 18 14 18 16 18 17 19 10 19 15 19 17 19 18 20 10 20 15 20 18 20 19 12 11 17 16 -1...
Manager to Checker
OK good job!
result:
ok OK
Test #9:
score: 0
Wrong Answer
time: 1ms
memory: 3672kb
Interactor to First Run
15 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 1 0 1 1
First Run to Interactor
2 1 3 2 4 2 4 3 5 3 3 2 2 1 6 3 6 5 7 4 4 2 4 3 8 4 8 6 8 7 9 5 9 7 7 6 10 5 10 8 8 7 11 6 11 9 11 10 12 6 12 9 12 11 11 10 13 7 7 4 4 2 4 3 14 7 7 4 4 2 4 3 15 8 8 4 4 2 4 3 8 5 9 6 6 7 13 10 10 11 15 12 7 14 -1 -1
Interactor to Second Run
15 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 0 1 1 0 0 0 0 1 1 0 1
Second Run to Interactor
2 1 3 2 4 2 4 3 5 3 5 4 6 3 6 5 7 4 7 6 8 4 8 6 6 5 9 5 9 7 9 8 10 5 10 8 10 9 11 6 11 9 11 10 12 6 12 9 12 11 11 10 13 7 13 10 13 12 12 11 14 7 14 11 11 9 9 8 15 8 15 12 15 14 8 7 11 10 13 12 12 14 -1 -1
Manager to Checker
WA array is not sorted!
result:
wrong answer WA