QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#662121 | #4831. Eager Sorting | N_z_ | 0 | 1ms | 3800kb | C++23 | 611b | 2024-10-20 21:12:42 | 2024-10-20 21:12:43 |
answer
#include<bits/stdc++.h>
using namespace std;
int a[101];
void work(int l,int r)
{
if(l==r){a[l]=l;return;}
int mi=(l+r)/2;
work(l,mi),work(mi+1,r);
vector<int>_;
int al=l,bl=mi+1;
while(al<=mi&&bl<=r)
{
cout<<a[al]<<' '<<a[bl]<<endl;
int res;
cin>>res;
if(res==-1)exit(0);
if(res)swap(a[al],a[bl]);
if(a[al]<a[bl])_.emplace_back(a[al++]);
else _.emplace_back(a[bl++]);
}
while(al<=mi)_.emplace_back(a[al++]);
while(bl<=r)_.emplace_back(a[bl++]);
for(int x=0;x<_.size();x++)
a[x+l]=_[x];
}
int main()
{
int n;
cin>>n;
work(1,n);
cout<<"-1 -1"<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3800kb
Interactor to First Run
5 0 1 1 0 0 1 0
First Run to Interactor
1 2 1 3 4 5 1 4 3 4 2 4 4 5 -1 -1
Interactor to Second Run
5 0 0 1 0 0 0 0
Second Run to Interactor
1 2 1 3 2 3 4 5 1 4 2 4 3 4 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #2:
score: 100
Accepted
time: 1ms
memory: 3580kb
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: 3784kb
Interactor to First Run
2 0
First Run to Interactor
1 2 -1 -1
Interactor to Second Run
2 0
Second Run to Interactor
1 2 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #4:
score: 100
Accepted
time: 1ms
memory: 3712kb
Interactor to First Run
2 1
First Run to Interactor
1 2 -1 -1
Interactor to Second Run
2 0
Second Run to Interactor
1 2 -1 -1
Manager to Checker
OK good job!
result:
ok OK
Test #5:
score: 0
Wrong Answer
time: 1ms
memory: 3584kb
Interactor to First Run
9 1 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0
First Run to Interactor
1 2 1 3 2 3 4 5 1 4 2 4 3 4 6 7 8 9 6 8 7 8 8 9 1 6 6 7 2 7 3 7 4 7 5 7 7 8 8 9 -1 -1
Interactor to Second Run
9 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
Second Run to Interactor
1 2 1 3 2 3 4 5 1 4 2 4 3 4 6 7 8 9 6 8 7 8 1 6 2 6 6 7 3 7 4 7 5 7 -1 -1
Manager to Checker
WA array is not sorted!
result:
wrong answer WA