# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
552796 | 2022-04-24T02:45:45 Z | Killer2501 | 사육제 (CEOI14_carnival) | C++14 | 13 ms | 336 KB |
#include <bits/stdc++.h> #define ll long long #define ld long double #define ull unsigned long long #define pb push_back #define pll pair<int, pii> #define pii pair<int, int> #define fi first #define se second using namespace std; const int N = 2e2+2; const int M = 60; const int mod = 1e9+7; const ll base = 1e6; const ll inf = 1e9; int n, m, b[N], a[N], k, t, d[N], cnt, par[N], f[N]; ll ans; vector<int> adj[N], vi; bool vis[N], ok; set<pii> leaf; int ask() { if(vi.size() == 1)return 1; cout << vi.size() << " "; for(int x: vi)cout << x <<" "; cout << endl; cin >> k; return k; } void sol() { cin >> n; b[1] = 1; a[1] = 1; m = 1; for(int i = 2; i <= n; i ++) { vi.clear(); for(int j = 1; j <= i; j ++)vi.pb(j); b[i] = ask(); if(b[i] > m) { a[i] = ++m; continue; } int l = 1, r = i-1, mid; while(l <= r) { mid = (l+r)>>1; vi.clear(); for(int j = 1; j <= mid; j ++)vi.pb(j); vi.pb(i); if(ask() > b[mid])l = mid+1; else r = mid-1; } a[i] = a[l]; } cout << 0 <<" "; for(int i = 1; i <= n; i ++)cout << a[i] <<" "; cout << endl; } int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); #define task "tests" if(fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } int test = 1; //cin >> test; while(test -- > 0)sol(); return 0; } /* 2 1 6 5 4 3 */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 336 KB | Output is correct |
2 | Correct | 8 ms | 324 KB | Output is correct |
3 | Correct | 5 ms | 328 KB | Output is correct |
4 | Correct | 3 ms | 208 KB | Output is correct |
5 | Correct | 9 ms | 324 KB | Output is correct |
6 | Correct | 9 ms | 320 KB | Output is correct |
7 | Correct | 9 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 208 KB | Output is correct |
2 | Correct | 10 ms | 208 KB | Output is correct |
3 | Correct | 5 ms | 208 KB | Output is correct |
4 | Correct | 5 ms | 320 KB | Output is correct |
5 | Correct | 11 ms | 208 KB | Output is correct |
6 | Correct | 9 ms | 336 KB | Output is correct |
7 | Correct | 11 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 324 KB | Output is correct |
2 | Correct | 9 ms | 320 KB | Output is correct |
3 | Correct | 8 ms | 320 KB | Output is correct |
4 | Correct | 4 ms | 324 KB | Output is correct |
5 | Correct | 8 ms | 328 KB | Output is correct |
6 | Correct | 7 ms | 316 KB | Output is correct |
7 | Correct | 7 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 312 KB | Output is correct |
2 | Correct | 8 ms | 320 KB | Output is correct |
3 | Correct | 5 ms | 328 KB | Output is correct |
4 | Correct | 3 ms | 320 KB | Output is correct |
5 | Correct | 10 ms | 208 KB | Output is correct |
6 | Correct | 5 ms | 208 KB | Output is correct |
7 | Correct | 8 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 328 KB | Output is correct |
2 | Correct | 11 ms | 328 KB | Output is correct |
3 | Correct | 8 ms | 208 KB | Output is correct |
4 | Correct | 8 ms | 324 KB | Output is correct |
5 | Correct | 9 ms | 328 KB | Output is correct |
6 | Correct | 7 ms | 312 KB | Output is correct |
7 | Correct | 3 ms | 324 KB | Output is correct |