QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#647460#8819. CNOI Knowledgeplanckconstant#WA 0ms3616kbC++201.1kb2024-10-17 14:19:072024-10-17 14:19:07

Judging History

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

  • [2024-10-17 14:19:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2024-10-17 14:19:07]
  • 提交

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;
            bool ok=1;
            if(mid>i-1){
                ok=0;
            }
            assert(ok);
            cin>>x2;
            if((x1-x2)==(x2+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: 0
Wrong Answer
time: 0ms
memory: 3616kb

input:

12
3
1
3
1
6
3
6
3
3
1
6
3
3
1
10
6
3
1
6
3
10
6
3
1
6
3
14
10
6
3
3
1
14
9
6
3
3
1
19
14
5
3
2
1
19
14
5
2
8
5
25
19
9
5
3
1
6
3

output:

? 1 2
? 1 1
? 2 3
? 2 2
? 1 3
? 1 2
? 2 4
? 2 3
? 3 4
? 3 3
? 3 5
? 3 4
? 4 5
? 4 4
? 3 6
? 3 5
? 5 6
? 5 5
? 4 6
? 4 5
? 4 7
? 4 6
? 6 7
? 6 6
? 5 7
? 5 6
? 4 8
? 4 7
? 6 8
? 6 7
? 7 8
? 7 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
? 8 1...

result:

wrong answer Wrong Answer.