QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#811850 | #9783. Duloc Network | I_Love_Sonechka# | Compile Error | / | / | C++20 | 3.1kb | 2024-12-13 03:31:55 | 2024-12-13 03:31:56 |
Judging History
answer
#include <complex.h>
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pi pair<int, int>
#define pb push_back
using namespace std;
using ll = long long;
template<typename T_container, typename T = typename enable_if
<!is_same<T_container, string>::value, typename
T_container::value_type>::type>
ostream& operator<<(ostream &os, const T_container &v) {
os << '{';
string sep;
for(const T &x : v) {
os << sep << x;
sep = ", ";
}
return os << '}';
}
void dbg_out(){cerr<<endl;}
template <typename Head, typename... Tail>void dbg_out(Head H
, Tail... T){cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) dbg_out(__VA_ARGS__)
// #define TEST_CASES
#define vt vector
const int amax = 12;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void get() {
int n = 200;
double res = 0;
for(int i = 1; i < n; ++i) {
double P = 1;
for(int j = 1; j <= i; ++j) {
P /= i;
res += P * j;
P *= (i-1);
}
}
cout << 2 * res << '\n';
}
const int MAX_QUERIES = 3500;
void solve() {
int n; cin >> n;
map<string, int> queries;
auto Ask = [&](string s) -> int {
if(queries.count(s)) {
return queries[s];
}
if(queries.size() == MAX_QUERIES) {
cout << "! " << rng() % 2 << endl;
exit(0);
}
assert(queries.size() < MAX_QUERIES);
cout << "? " << s << endl;
fflush(stdout);
int ret; cin >> ret;
return queries[s] = ret;
};
string S;
for(int i = 0; i < n; ++i) {
S.push_back('0');
}
string T = S;
S[rng()%n] = '1';
for(int i = 1; i < n; ++i) {
vt<int> other;
for(int j = 0; j < n; ++j) if(S[j] == '0') {
other.push_back(j);
}
int value = Ask(S);
if(value == n - i) {
break;
}
if(value == 0) {
cout << "! 0" << endl;
fflush(stdout);
return ;
}
// stable_sort(other.begin(), other.end(), [&](int x, int y) -> bool {
// T[x] = '1';
// auto ask_x = Ask(T);
// T[x] = '0';
// T[y] = '1';
// auto ask_y = Ask(T);
// T[y] = '0';
// return ask_x < ask_y;
// });
random_shuffle(other.begin(), other.end(), rng);
for(auto u: other) {
T[u] = '1';
int u_value = Ask(T);
T[u] = '0';
S[u] = '1';
int u_and_s = Ask(S);
S[u] = '0';
int s_value = Ask(S);
int inter = s_value + u_value - u_and_s;
if(inter != 0) {
S[u] = '1';
break;
}
}
}
cout << "! 1" << endl;
fflush(stdout);
}
int main() {
// cin.tie(0)->sync_with_stdio(0);
int tt = 1;
#ifdef TEST_CASES
cin >> tt;
#endif
while(tt--)
solve();
return 0;
}
Details
In file included from /usr/include/c++/13/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from answer.code:2: /usr/include/c++/13/bits/stl_algo.h: In instantiation of ‘void std::random_shuffle(_RAIter, _RAIter, _Generator&&) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Generator = mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>&]’: answer.code:102:23: required from here /usr/include/c++/13/bits/stl_algo.h:4636:55: error: no match for call to ‘(std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>) (__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)’ 4636 | _RandomAccessIterator __j = __first + __rand((__i - __first) + 1); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/random:53, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:179: /usr/include/c++/13/bits/random.tcc:453:5: note: candidate: ‘std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::operator()() [with _UIntType = long unsigned int; long unsigned int __w = 32; long unsigned int __n = 624; long unsigned int __m = 397; long unsigned int __r = 31; _UIntType __a = 2567483615; long unsigned int __u = 11; _UIntType __d = 4294967295; long unsigned int __s = 7; _UIntType __b = 2636928640; long unsigned int __t = 15; _UIntType __c = 4022730752; long unsigned int __l = 18; _UIntType __f = 1812433253; result_type = long unsigned int]’ 453 | mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | __s, __b, __t, __c, __l, __f>:: | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/random.tcc:453:5: note: candidate expects 0 arguments, 1 provided