QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#785620#9783. Duloc Networkjaker#WA 1ms3812kbC++171.7kb2024-11-26 18:34:162024-11-26 18:34:18

Judging History

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

  • [2024-11-26 18:34:18]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3812kb
  • [2024-11-26 18:34:16]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,j,k) for(int i = j;i <= k;++i)
int n;
vector<int>now;
unordered_map<string,int>asked;
int ask(const vector<int> &tmp) {
    string s;
    rep(i,1,n) s += '0';
    for( auto x : tmp ) s[x-1] = '1';
    int ans;
    if( asked.find( s ) == asked.end() ) {
        cout << s << endl;
        fflush(stdout);
        cin >> ans;
        asked[s] = ans;
    }
    else ans = asked[s];
    if( ans == 0 ) {
        cout << "! 0" << endl;
        exit(0);
    }
    return ans;
}
bool ok(vector<int>tmp) {
    int cnt1 = ask( now ) , cnt2 = ask(tmp);
    for( auto x : now ) tmp.push_back( x );
    int cnt3 = ask( tmp );
    if( cnt1 + cnt2 > cnt3 ) return true;
    else return false;
}
bool in_now[210];
vector<int>rest,tmpl,tmpr;
int main() {
    cin >> n;
    now.push_back(1); in_now[1] = true;
    rep(round,2,n) {
        rest.clear();
        rep(x,1,n) if(!in_now[x]) 
            rest.push_back(x);
        ask(rest);
        while( (int)rest.size() > 1 ) {
            int mid = (int)(rest.size()) / 2;
            tmpl.clear(); tmpr.clear();
            rep(i,0,mid-1) tmpl.push_back( rest[i] );
            rep(i,mid,(int)(rest.size())-1)
                tmpr.push_back( rest[i] );
            // printf("l r:\n");
            // for( auto x : tmpl ) printf("%d ",x); printf("\n");
            // for( auto x : tmpr ) printf("%d ",x); printf("\n\n");
            if( ok(tmpl) ) rest = tmpl;
            else rest = tmpr;
        }
        now.push_back( rest[0] );
        in_now[rest[0]] = true;
    }
    cout << "! 1" << endl;
    return 0;
}

详细

Test #1:

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

input:

4

output:

0111

result:

wrong answer format  Expected '!' or '?', but found '0111'