QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#785620 | #9783. Duloc Network | jaker# | WA | 1ms | 3812kb | C++17 | 1.7kb | 2024-11-26 18:34:16 | 2024-11-26 18:34:18 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3812kb
input:
4
output:
0111
result:
wrong answer format Expected '!' or '?', but found '0111'