QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#827917 | #9783. Duloc Network | Zawos | WA | 4ms | 3816kb | C++20 | 1.4kb | 2024-12-23 11:25:35 | 2024-12-23 11:25:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vii = vector<ii>;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define pb(x) push_back(x)
int ask(set<int> st, int n) {
string s(n, '0');
for (auto x : st)
s[x] = '1';
cout << "? " << s << endl;
int res; cin >> res;
return res;
}
set<int> OR(set<int> &a, set<int> &b) {
set<int> st = a;
for (auto x : b)
st.insert(x);
return st;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int n; cin >> n;
set<int> A, B;
A.insert(0);
rep(i, 1, n)
B.insert(i);
int fA = ask(A, n);
rep(i, 0, n - 1) {
if (!fA) return cout << "! 0" << endl, 0;
set<int> cur = B;
while (cur.size() > 1) {
set<int> L;
while (L.size() < cur.size()) {
L.insert(*cur.begin());
cur.erase(cur.begin());
}
int fB = ask(L, n), fAB = fA + ask(OR(A, L), n);
if (!fB) return cout << "! 0" << endl, 0;
if (fA + fB != fAB)
cur = L;
}
if (cur.empty()) cout << "! 0" << endl, 0;
A.insert(*cur.begin());
B.erase(*cur.begin());
fA = ask(A, n);
}
cout << "! 1" << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3752kb
input:
4 1 2 1 3 2 2 2 1 1 0
output:
? 1000 ? 0110 ? 1110 ? 0100 ? 1100 ? 1100 ? 0010 ? 1110 ? 1110 ? 1111 ! 1
result:
ok Correct answer with 10 queries.
Test #2:
score: 0
Accepted
time: 1ms
memory: 3780kb
input:
2 0
output:
? 10 ! 0
result:
ok Correct answer with 1 queries.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
4 1 2 1 3 2 2 2 1 1 0
output:
? 1000 ? 0110 ? 1110 ? 0100 ? 1100 ? 1100 ? 0010 ? 1110 ? 1110 ? 1111 ! 1
result:
ok Correct answer with 10 queries.
Test #4:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
2 0
output:
? 10 ! 0
result:
ok Correct answer with 1 queries.
Test #5:
score: 0
Accepted
time: 3ms
memory: 3624kb
input:
50 3 13 14 13 14 9 12 4 7 2 5 1 4 4 14 14 15 15 9 11 4 8 4 8 4 8 8 14 14 15 17 12 15 7 13 5 12 3 11 11 15 14 14 15 10 17 3 12 2 12 1 11 11 14 13 15 17 10 16 5 15 2 12 1 12 12 14 13 15 17 11 17 8 16 5 15 1 12 12 14 12 17 18 10 17 8 17 7 16 4 15 15 15 12 17 17 6 17 3 16 2 17 1 16 16 16 13 17 18 10 18 ...
output:
? 10000000000000000000000000000000000000000000000000 ? 01111111111111111111111111000000000000000000000000 ? 11111111111111111111111111000000000000000000000000 ? 01111111111111000000000000000000000000000000000000 ? 11111111111111000000000000000000000000000000000000 ? 011111110000000000000000000000000...
result:
ok Correct answer with 413 queries.
Test #6:
score: 0
Accepted
time: 2ms
memory: 3608kb
input:
50 10 25 24 36 35 33 34 29 30 19 21 13 19 19 26 24 37 35 31 34 23 30 12 22 8 21 21 26 23 37 34 32 35 22 32 18 30 6 22 22 27 23 36 33 30 35 23 33 18 32 13 30 30 27 22 36 32 32 34 20 34 16 33 8 32 32 28 22 37 32 36 35 21 35 15 34 10 33 33 28 21 36 31 36 36 24 33 20 34 11 33 33 29 21 37 31 36 35 18 34 ...
output:
? 10000000000000000000000000000000000000000000000000 ? 01111111111111111111111111000000000000000000000000 ? 11111111111111111111111111000000000000000000000000 ? 01111111111111000000000000000000000000000000000000 ? 11111111111111000000000000000000000000000000000000 ? 011111110000000000000000000000000...
result:
ok Correct answer with 512 queries.
Test #7:
score: -100
Wrong Answer
time: 4ms
memory: 3544kb
input:
50 1 16 16 17 18 13 14 7 8 5 6 4 5 5 17 18 16 18 13 15 8 10 4 8 3 7 7 17 17 17 18 13 14 6 13 3 10 1 8 8 18 17 13 16 9 15 8 14 5 11 1 9 9 17 16 12 16 7 14 8 15 7 14 4 11 11 17 16 10 16 6 16 5 16 4 15 3 14 14 18 16 13 16 7 17 3 15 2 16 1 15 15 17 16 12 15 7 16 2 14 2 15 1 16 16 17 16 12 16 7 17 4 16 1...
output:
? 10000000000000000000000000000000000000000000000000 ? 01111111111111111111111111000000000000000000000000 ? 11111111111111111111111111000000000000000000000000 ? 00000000000000000000000000111111111111000000000000 ? 10000000000000000000000000111111111111000000000000 ? 000000000000000000000000001111110...
result:
wrong answer Wrong answer.