#include "chameleon.h"
#include<bits/stdc++.h>
using ll = int;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))
namespace {
int variable_example = 1;
} // namespace
namespace MOMJOKES{
const ll MAXN = 510*2;
ll L[MAXN],R[MAXN];
vector <ll> cand[MAXN];
ll pf[MAXN];
ll sf[MAXN];
}
void TLE(){
ll i=0;
while (i<=1e18)i++;
}
ll cnt = 0;
ll query(vector <ll> tmp){
cnt++;
// if (cnt>20000)exit(0);
// for (auto x:tmp)cout<<x<<' ';
// cout<<endl;
return Query(tmp);
}
void Solve(int n) {
using namespace MOMJOKES;
vector <ll> comp[4];
for (ll i = 1;i <= 2 * n;i ++){
bool done = 0;
for (ll j = 0;j < 4;j ++){
// cout<<"SUS "<<i<<' '<<j<<endl;
vector <ll> cur = comp[j];
bool ok = 1;
while (1){
cur.push_back(i);
if (query(cur)==sz(cur))break;
cur.pop_back();
ok=0;
ll l = 0,r = sz(cur)-1;
while(l <= r){
ll mid = (l + r) >> 1;
vector <ll> tmp;
for (ll j = mid;j < sz(cur);j ++)tmp.push_back(cur[j]);
tmp.push_back(i);
if (query(tmp) == sz(tmp)){r = mid - 1;}
else l = mid + 1;
}
l--;
// cout<<"WAT "<<i<<' '<<cur[l]<<endl;
cand[i].push_back(cur[l]);
cand[cur[l]].push_back(i);
cur.resize(l);
}
if (ok && !done){done = 1;comp[j].push_back(i);}
}
}
set <pll> s;
for (ll i = 1;i <= 2 * n;i ++){
if (sz(cand[i]) == 3){
for (ll j = 0;j < 3;j ++){
vector <ll> all = {i};
for (ll j1 = 0;j1 < 3;j1 ++){
if (j1 != j)all.push_back(cand[i][j1]);
}
if (j == 2 || query(all) == 1){
L[i] = cand[i][j];
break;
}
}
}
else{
ll u = i,v = cand[i][0];
if (u > v)swap(u,v);
s.insert(MP(u,v));
}
}
for (ll i = 1;i <= 2 * n;i ++){
if (sz(cand[i]) == 3){
for (ll j = 0;j < 3;j ++){
if (cand[i][j] == L[i] || L[cand[i][j]] == i)continue;
ll u = i,v = cand[i][j];
if (u > v)swap(u,v);
s.insert(MP(u,v));
}
}
}
for (auto x:s)Answer(x.fi,x.se);
}
Compilation message
chameleon.cpp:15:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
15 | int variable_example = 1;
| ^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
14 ms |
548 KB |
Output is correct |
4 |
Correct |
12 ms |
344 KB |
Output is correct |
5 |
Correct |
11 ms |
344 KB |
Output is correct |
6 |
Correct |
11 ms |
560 KB |
Output is correct |
7 |
Correct |
12 ms |
344 KB |
Output is correct |
8 |
Correct |
11 ms |
544 KB |
Output is correct |
9 |
Correct |
12 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
23 ms |
344 KB |
Output is correct |
4 |
Correct |
23 ms |
552 KB |
Output is correct |
5 |
Correct |
22 ms |
344 KB |
Output is correct |
6 |
Correct |
22 ms |
512 KB |
Output is correct |
7 |
Correct |
23 ms |
344 KB |
Output is correct |
8 |
Correct |
22 ms |
344 KB |
Output is correct |
9 |
Correct |
23 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
14 ms |
548 KB |
Output is correct |
4 |
Correct |
12 ms |
344 KB |
Output is correct |
5 |
Correct |
11 ms |
344 KB |
Output is correct |
6 |
Correct |
11 ms |
560 KB |
Output is correct |
7 |
Correct |
12 ms |
344 KB |
Output is correct |
8 |
Correct |
11 ms |
544 KB |
Output is correct |
9 |
Correct |
12 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
0 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
23 ms |
344 KB |
Output is correct |
31 |
Correct |
23 ms |
552 KB |
Output is correct |
32 |
Correct |
22 ms |
344 KB |
Output is correct |
33 |
Correct |
22 ms |
512 KB |
Output is correct |
34 |
Correct |
23 ms |
344 KB |
Output is correct |
35 |
Correct |
22 ms |
344 KB |
Output is correct |
36 |
Correct |
23 ms |
344 KB |
Output is correct |
37 |
Correct |
22 ms |
344 KB |
Output is correct |
38 |
Correct |
11 ms |
344 KB |
Output is correct |
39 |
Correct |
21 ms |
344 KB |
Output is correct |
40 |
Correct |
26 ms |
344 KB |
Output is correct |
41 |
Correct |
24 ms |
344 KB |
Output is correct |
42 |
Correct |
14 ms |
344 KB |
Output is correct |
43 |
Correct |
22 ms |
556 KB |
Output is correct |
44 |
Correct |
21 ms |
344 KB |
Output is correct |
45 |
Correct |
21 ms |
544 KB |
Output is correct |