QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#647604#8819. CNOI KnowledgeplanckconstantWA 1ms3528kbC++20969b2024-10-17 14:54:042024-10-17 14:54:06

Judging History

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

  • [2024-10-17 14:54:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3528kb
  • [2024-10-17 14:54:04]
  • 提交

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;
            if(x1==(i-mid+1)*(i-mid)/2+(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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

12
3
3
6
6
10
6
10
15
10
15
21
10
20
15
14
6
9
14
6
10
19
5
2
19
5
3
25
9
3
6

output:

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

result:

wrong answer Wrong Answer.