QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#662120 | #4831. Eager Sorting | N_z_ | 0 | 1ms | 3872kb | C++23 | 588b | 2024-10-20 21:10:59 | 2024-10-20 21:11:00 |
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)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;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3632kb
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: 3628kb
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
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: 3872kb
Interactor to First Run
2 1
First Run to Interactor
1 2 -1 -1
Interactor to Second Run
2 0 -1
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: 3832kb
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