QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#647406#8819. CNOI Knowledgeplanckconstant#WA 6ms3616kbC++141022b2024-10-17 13:55:252024-10-17 13:55:38

Judging History

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

  • [2024-10-17 13:55:38]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:3616kb
  • [2024-10-17 13:55:25]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define double long double
#define INF 1e15
void slove()
{
    int n;
    cin>>n;
    vector<int>a(n+5);
    a[1]=1;
    int num=1;
    for(int i=2;i<=n;i++){
        int l=1,r=i;
        while(l<r){
            int mid=(l+r)/2;
            int x1,x2;
            cout<<"? "<<mid<<' '<<i<<endl;
            cin>>x1;
            cout<<"? "<<mid<<' '<<i-1<<endl;
            cin>>x2;
            if((x1-x2)==(i-mid+1)){
                r=mid;
            }
            else{
                l=mid+1;
            }
        }
        if(l==1){
            a[i]=++num;
        }
        else{
            a[i]=a[l-1];
        }
    }
    cout<<"! ";
    for(int i=1;i<=n;i++){
        cout<<a[i]<<' ';
    }
    cout<<endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin >> t;
    while (t--) {
        slove();
    }
    return 0;
}

详细

Test #1:

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

input:

12
3
1
3
1
6
3
6
3
10
6
6
3
10
6
15
10
10
6
15
10
21
15
10
6
20
15
15
10
14
10
6
3
9
6
14
9
27
20
34
26
43
34
19
14
5
3
2
1
19
14
5
2
8
5
25
19
9
5
13
8
19
13

output:

? 1 2
? 1 1
? 2 3
? 2 2
? 1 3
? 1 2
? 2 4
? 2 3
? 1 4
? 1 3
? 3 5
? 3 4
? 2 5
? 2 4
? 1 5
? 1 4
? 3 6
? 3 5
? 2 6
? 2 5
? 1 6
? 1 5
? 4 7
? 4 6
? 2 7
? 2 6
? 3 7
? 3 6
? 4 8
? 4 7
? 6 8
? 6 7
? 5 8
? 5 7
? 5 9
? 5 8
? 3 9
? 3 8
? 2 9
? 2 8
? 1 9
? 1 8
? 5 10
? 5 9
? 8 10
? 8 9
? 9 10
? 9 9
? 6 11
? ...

result:

ok Accepted. 62 queries used.

Test #2:

score: -100
Wrong Answer
time: 6ms
memory: 3448kb

input:

1000
3
1
2
1
3
2
2
1
5
2
7
3
11
7
8
5
2
1
7
5
2
1
11
7
5
2
7
3
11
7
5
3
3
1
15
11
5
3
2
1
15
11
3
2
2
1
19
15
4
3
2
1
17
14
4
3
2
1
20
17
4
3
2
1
15
13
4
3
2
1
23
15
9
4
13
6
15
7
23
15
11
7
5
3
3
1
31
23
11
8
5
3
3
1
36
27
11
7
5
3
2
1
45
36
15
11
3
2
2
1
48
39
15
11
5
2
7
3
11
7
58
48
16
11
5
3
2
...

output:

? 1 2
? 1 1
? 2 3
? 2 2
? 2 4
? 2 3
? 3 4
? 3 3
? 3 5
? 3 4
? 2 5
? 2 4
? 1 5
? 1 4
? 3 6
? 3 5
? 5 6
? 5 5
? 4 7
? 4 6
? 6 7
? 6 6
? 4 8
? 4 7
? 6 8
? 6 7
? 5 8
? 5 7
? 5 9
? 5 8
? 7 9
? 7 8
? 8 9
? 8 8
? 5 10
? 5 9
? 8 10
? 8 9
? 9 10
? 9 9
? 6 11
? 6 10
? 9 11
? 9 10
? 10 11
? 10 10
? 6 12
? 6 11...

result:

wrong answer Too many queries.