QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#785447#9783. Duloc Networkucup-team4975#WA 1ms3544kbC++232.2kb2024-11-26 17:58:492024-11-26 17:58:49

Judging History

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

  • [2024-11-26 17:58:49]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3544kb
  • [2024-11-26 17:58:49]
  • 提交

answer

#define LOCAL
#include <bits/stdc++.h>
#define fir first
#define sec second
#define el endl

#ifdef LOCAL
#define FINISH cerr << "FINISH" << endl;
#else
#define FINISH ;
#endif

#ifdef LOCAL
#define debug(x) cerr << setw(4) << #x << " == " << x << endl
#else
#define debug(x)
#endif

#ifdef LOCAL
#define debugv(x)                   \
    cerr << setw(4) << #x << ":: "; \
    for (auto i : x)                \
        cerr << i << " ";           \
    cerr << endl
#else
#define debugv(x)
#endif

using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
ostream& operator<<(ostream& out, PII& x)
{
    out << x.fir << " " << x.sec << endl;
    return out;
}

const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int N = 200020;

int con[205]={};
int n;

string qstr(int x){
    string res(n,'0');
    for(int i=x;i<con[x];i++){
        res[i]='1';
    }
    return res;
}
string qstr(int x,int y){
    string res(n,'0');
    for(int i=x;i<con[x];i++){
        res[i]='1';
    }
    for(int i=y;i<con[y];i++){
        res[i]='1';
    }
    return res;
}

bool query(int a1,int a2){
    int c1,c2,c12;
    cout<< "? " <<qstr(a1)<<el;
    cin>>c1;
    cout<< "? " <<qstr(a2)<<el;
    cin>>c2;
    cout<< "? " <<qstr(a1,a2)<<el;
    cin>>c12;
    if(c1+c2-c12==0){
        return false;
    }
    else return true;
}

void solve()
{
    cin>>n;
    for(int i=0;i<n;i++)con[i]=i+1;
    while(1){
        if(con[0]==n){
            break;
        }
        vector<int> tmp;
        tmp.push_back(0);
        for(int i=0;con[i]<n;i=con[i]){
            tmp.push_back(con[i]);
            if(query(i,con[i]))tmp.pop_back();
        }
        tmp.push_back(n);
        bool flag=0;
        for(int i=0;i<tmp.size()-1;i++){
            if(con[tmp[i]]!=tmp[i+1]){
                flag=1;
                con[tmp[i]]=tmp[i+1];
            }
        }
        if(flag){
            cout<<"! 0"<<el;
            return ;
        }
    }
    cout<<"! 1"<<el;
    return;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int T = 1;
    //cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

详细

Test #1:

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

input:

4
1
3
2
3
2
2
2
2
1

output:

? 1000
? 0100
? 1100
? 0100
? 0010
? 0110
? 0010
? 0001
? 0011
! 0

result:

wrong answer Wrong answer.