| Task: | Piiri |
| Sender: | aatukaj |
| Submission time: | 2025-01-18 16:48:40 +0200 |
| Language: | C++ (C++17) |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp:6:1: error: 'll' does not name a type; did you mean 'all'?
6 | ll n, m;
| ^~
| all
input/code.cpp:7:6: error: variable or field 'prll' declared void
7 | void prll(ll mask) {
| ^~~~
input/code.cpp:7:11: error: 'll' was not declared in this scope; did you mean 'all'?
7 | void prll(ll mask) {
| ^~
| all
input/code.cpp:12:1: error: 'll' does not name a type; did you mean 'all'?
12 | ll ask(ll mask) {
| ^~
| all
input/code.cpp:26:1: error: 'uniform_ll_distribution' does not name a type
26 | uniform_ll_distribution<ll> dist(0, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~
input/code.cpp:27:1: error: 'll' does not name a type; did you mean 'all'?
27 | ll rand(ll l, ll r) {
| ^~
| all
input/code.cpp: In function 'void solve()':
input/code.cpp:33:16: error: 'n' was not declared in this scope; did you mean 'yn'?
33 | cin >> n >> m;
| ^
| yn...Code
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
using namespace std;
const int maxN = 2e5+10;
ll n, m;
void prll(ll mask) {
for (ll i=0; i<n; i++) {
cout << char((mask>>i&1)+'0');
}
}
ll ask(ll mask) {
cout << "? ";
prll(mask);
cout << endl;
ll res = 0;
for (ll i=0; i<m; i++) {
char c;
cin >> c;
res += (c-'0')*(1<<i);
}
return res;
}
random_device rd;
mt19937 gen(rd());
uniform_ll_distribution<ll> dist(0, 0);
ll rand(ll l, ll r) {
dist.param(uniform_ll_distribution<ll>::param_type{l, r});
return dist(gen);
}
void solve() {
cin >> n >> m;
map<ll, ll> prev;
if (n<=10) {
for (ll mask=0; mask<1<<n; mask++) {
ll res = ask(mask);
if (prev.count(res)) {
cout << "YES\n";
prll(prev[res]);
cout << '\n';
prll(mask);
cout << endl;
return;
}
prev[res] = mask;
}
} else {
for (ll i=0; i<3000; i++) {
ll mask = rand(0, (1<<n)-1);
ll res = ask(mask);
if (prev.count(res)) {
cout << "YES\n";
prll(prev[res]);
cout << '\n';
prll(mask);
cout << endl;
return;
}
prev[res] = mask;
}
}
cout << "NO\n";
cout << endl;
}
int main() {
solve();
}
