QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#662780#4831. Eager Sortingrotcar070 1ms3740kbC++23832b2024-10-21 10:19:042024-10-21 10:19:05

Judging History

你现在查看的是最新测评结果

  • [2024-10-21 10:19:05]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3740kb
  • [2024-10-21 10:19:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int b[105];int c[105];
inline int ask(int x,int y){cout<<x<<' '<<y<<endl;}
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 pos=0;
            for(int j=i+1;j<=n;j++) if(b[j]==i){pos=j;break;}
            cout<<i<<' '<<pos<<endl;
            int z;cin>>z;
            swap(b[i],b[pos]); 
        }
    }
    cout<<"-1 -1"<<endl;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3736kb

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
4 5
-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: 3660kb

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: 3712kb

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: 3596kb

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: 3716kb

Interactor to First Run

9
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
0
0
1
0
1

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
4 6
7 9
8 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
0

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: 3672kb

Interactor to First Run

9
0
1
1
1
1
1
0
0
1
0
0
1
0
0
0
0
1
0
0
1
1
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
6 9
7 9
8 9
-1 -1

Interactor to Second Run

9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

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
8 7
9 5
9 7
9 8
-1 -1

Manager to Checker

OK
good job!

result:

ok OK

Test #7:

score: 100
Accepted
time: 1ms
memory: 3672kb

Interactor to First Run

6
1
0
1
1
1
0
1
1
0
1
1

First Run to Interactor

2 1
3 2
4 2
2 1
5 3
3 2
6 3
3 2
2 1
4 6
5 6
-1 -1

Interactor to Second Run

6
0
0
0
0
0
0
0
0

Second Run to Interactor

2 1
3 2
4 2
4 3
5 3
5 4
6 3
6 5
-1 -1

Manager to Checker

OK
good job!

result:

ok OK

Test #8:

score: 100
Accepted
time: 1ms
memory: 3740kb

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
1
1
1
1
1
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
4 5
6 10
...

Interactor to Second Run

20
0
0
0
0
0
0
0
0
0
0
0
0
0
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
0
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
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
11 12
16 17
-1 -1

Manager to Checker

OK
good job!

result:

ok OK

Test #9:

score: 100
Accepted
time: 1ms
memory: 3716kb

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
1
1
1
0
1
1
0
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
5 8
6 7
7 14
9 14
10 11
11 15
12 14
13 15
14 15
-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
0
0
0
0
0
0
1
1
0
1
0
0
0
0
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
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
10 9
14 7
14 11
14 13
15 8
15 12
15 14
7 8
11 13
12 13
-1 -1

Manager to Checker

OK
good job!

result:

ok OK

Test #10:

score: 0
Wrong Answer
time: 1ms
memory: 3676kb

Interactor to First Run

20
0
1
1
1
0
1
1
0
1
0
1
1
0
1
1
0
1
1
0
1
1
1
1
1
0
0
1
0
1
1
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
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
3 2
7 4
4 2
2 1
8 4
4 2
2 1
9 5
5 3
3 2
10 5
5 3
3 2
2 1
11 6
6 3
6 5
12 6
6 3
6 5
5 4
13 7
7 4
7 6
14 7
7 4
7 6
6 5
15 8
15 12
15 14
16 8
16 12
16 14
16 15
17 9
17 13
17 15
17 16
18 9
9 5
9 7
9 8
19 10
10 5
10 8
8 7
7 6
20 10
10 5
10 8
10 9
7 8
10 14
11 14
13 20
...

Interactor to Second Run

20
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
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
7 4
7 6
8 4
8 6
8 7
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
10 9
14 7
14 11
11 9
11 10
15 8
15 12
12 10
12 11
16 8
16 12
16 14
16 15
17 9
17 13
17 15
17 16
18 9
18 14
18 16
16 15
19 10
19 15
19 17
19 18
20 10
20 15
20 18
20 19
17 18...

Manager to Checker

WA
array is not sorted!

result:

wrong answer WA