이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
컴파일 시 표준 에러 (stderr) 메시지
chameleon.cpp:15:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
15 | int variable_example = 1;
| ^~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |