QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#250849#6303. InversionDepletedPrism#WA 3ms3708kbC++172.1kb2023-11-13 19:40:322023-11-13 19:40:32

Judging History

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

  • [2023-11-13 19:40:32]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3708kb
  • [2023-11-13 19:40:32]
  • 提交

answer

/*
* @Author: zxxzy
* @Date:   2023-06-26 23:15:27
*/
#include <iostream>
#include <algorithm>
#include <cstring>
#include <bitset>
#include <set>
#include <cmath>
#include <vector>
#include <map>
//#define int long long
#define space ' '
// #define endl '\n'
#define de(x) cout<<"** "<<x<<" **"<<endl;
#define N 200005
using namespace std;
using ll=long long;
const int mod=998244353;
const int INF=0x3f3f3f3f;
const double eps=1e-6;

int pos[N],bin[N],tmp;
void pr(int l,int r){
    cout<<"? "<<l<<space<<r<<endl;
}
bool ch(int mid,int pos){
    if(pos==bin[mid]+1){
        pr(bin[mid],pos);
        cin>>tmp;
        return tmp;
    }
    int a,b,c,d;
    pr(bin[mid],pos);
    cin>>a;
    pr(bin[mid]+1,pos);
    cin>>b;
    pr(bin[mid]+1,pos-1);
    cin>>c;
    pr(bin[mid],pos-1);
    cin>>d;
    return a^b^c^d;
}
int bnrsch(int l,int r,int now){
    int mid;
    while(l+1<r){
        mid=(l+r)>>1;
        (ch(mid,now)?r:l)=mid;
    }
    return ch(r,now)?l:r;
}
signed main(){
    #ifdef LOCAL
        freopen("D:\\code2023\\test\\input.txt", "r", stdin);
        freopen("D:\\code2023\\test\\output.txt", "w", stdout);
    #endif
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    if(n==1){
        cout<<"! 1"<<endl;
    }else{
        pos[1]=1;
        bin[1]=1;
        pr(1,2);
        cin>>tmp;
        if(tmp){
            pos[1]=2;
            pos[2]=1;
            bin[1]=2;
            bin[2]=1;
        }else{
            bin[2]=2;
            pos[2]=2;
        }
        for(int i=3;i<=n;i++){
            int t=bnrsch(1,i-1,i);
            if(ch(t,i)){
                t=0;
            }
            for(int j=1;j<i;j++){
                if(pos[j]>=t){
                    pos[j]++;
                }
            }
            pos[i]=t+1;
            for(int j=1;j<=i;j++){
                bin[pos[i]]=i;
            }
        }
        cout<<"! ";
        for(int i=1;i<=n;i++){
            cout<<pos[i]<<space;
        }
    }

    return 0;
}



詳細信息

Test #1:

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

input:

3
0
1
0
1
0
0

output:

? 1 2
? 2 3
? 1 3
? 2 3
? 2 2
? 1 2
! 2 3 1 

result:

ok OK, guesses=6

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 3592kb

input:

1993
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
1
0
0
1
1
0
1
0
0
0
0
0
1
1
0
0
1
0
0
1
0
0
0
1
0
1
0
0
1
0
1
0
0
0
1
0
1
1
1
0
1
0
1

output:

? 1 2
? 2 3
? 2 3
? 2 4
? 3 4
? 3 3
? 2 3
? 3 4
? 3 4
? 2 5
? 3 5
? 3 4
? 2 4
? 2 5
? 3 5
? 3 4
? 2 4
? 1 5
? 2 5
? 2 4
? 1 4
? 3 6
? 4 6
? 4 5
? 3 5
? 2 6
? 3 6
? 3 5
? 2 5
? 2 6
? 3 6
? 3 5
? 2 5
? 5 6
? 3 7
? 4 7
? 4 6
? 3 6
? 6 7
? 6 7
? 5 7
? 6 7
? 6 6
? 5 6
? 4 8
? 5 8
? 5 7
? 4 7
? 6 8
? 7 8
...

result:

wrong output format Unexpected end of file - int32 expected