#include <bits/stdc++.h>
#include "library.h"
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define en '\n'
#define sp ' '
#define tb '\t'
#define ri(n) int n; cin >> n
#define rl(n) ll n; cin >> n
#define rs(s) string s; cin >> s
#define rc(c) char c; cin >> c
#define rv(v) for (auto &x : v) cin >> x
#define pven(v) for (auto x : v) cout << x << en
#define pv(v) for (auto x : v) cout << x << sp; cout << en
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yes cout << "Yes" << en
#define no cout << "No" << en
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define ssort(a, b) if (a < b) swap(a, b)
#define bitcnt(a) (__builtin_popcountll(a))
#define bithigh(a) (63-__builtin_clzll(a))
#define lg bithigh
#define highpow(a) (1LL << (ll)lg(a))
using namespace std;
const ll LINF = 1e18;
const int mxN = 1e3+10, INF = 2e9;
ll n;
vector<int> g[mxN], ans;
void dfs(int s, int p = -1){
ans.pb(s+1);
for (int u : g[s])
if (u^p) dfs(u, s);
}
int Get(int i, int l, int r){
vector<int> M(n, 0);
for (int i = l; i <= r; i++)
M[i] = 1;
int x = Query(M);
M[i] = 1;
return 1 - (Query(M) - x);
}
void BS(int i, int l, int r, int x){
if (l == r){
g[i].pb(l);
g[l].pb(i);
return;
}
int k = (l + r)>>1;
int y = Get(i, l, k);
if (y) BS(i, l, k, y);
if (x-y) BS(i, k+1, r, x-y);
}
void Solve(int N)
{
cerr << 1 << endl;
n = N;
for (int i = 1; i < n; i++){
int x = Get(i, 0, i-1);
if (x) BS(i, 0, i-1, x);
}
int s;
for (s = 0; g[s].size() > 1; s++)
dfs(s);
Answer(ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
39 ms |
308 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
39 ms |
308 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |