# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
918238 | 2024-01-29T13:43:20 Z | AtabayRajabli | 사육제 (CEOI14_carnival) | C++17 | 4 ms | 720 KB |
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; // author : a1abay // (a / b) % c = (a * b ^ (mod - 2)) % c; #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define whole(a) a+1, a+1+n #define se second #define fi first #define int ll #define print(k) cerr << "Ans : "; cout << k << endl; #define ins insert #define bpc __builtin_popcountll #define skip continue #define endll '\n' #define gcd(a, b) __gcd(a, b) #define lcm(a, b) (a*b / (__gcd(a, b))) #define mpr make_pair #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> typedef long long ll; typedef unsigned long long ull; typedef long double ld; const int sz = 5e5 + 5; using namespace std; void open(string s, string f) { freopen((s + ".txt").c_str(), "r", stdin); freopen((f + ".txt").c_str(), "w", stdout); } const int mod = 1e9 + 7; int P = 37; int n; void solve() { cin >> n; vector<int> v; int ans[n + 1] = {0}; ans[1] = 1; v.pb(1); int last = 1, ind = 2; for(int i = 2; i <= n; i++) { v.pb(ind); cout << v.size() << " "; for(int j : v)cout << j << " "; cout << endl; int cnt; cin >> cnt; if(cnt == last + 1) { ans[i] = ind; last = cnt; ind++; } else { v.pop_back(); int l = 0, r = v.size() - 1; while (l <= r) { int mid = (l + r) / 2; cout << mid - l + 1 + 1 << " "; for(int j = l; j <= mid; j++)cout << v[j] << " "; cout << ind << endl; int cnt; cin >> cnt; if(cnt == mid - l + 1 + 1)l = mid + 1; else r = mid - 1; } ans[i] = v[r + 1]; ind++; } } map<int, int> c; for(int i = 1; i <= n; i++)c[ans[i]]; int cnt = 1; for(pii p : c) { c[p.fi] = cnt++; } cout << 0 << " "; for(int i = 1; i <= n; i++)cout << c[ans[i]] << " "; cout << endl; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // open("in", "out"); int t = 1; // cin >> t; while(t--) { solve(); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 344 KB | Output is correct |
2 | Correct | 3 ms | 448 KB | Output is correct |
3 | Correct | 2 ms | 720 KB | Output is correct |
4 | Correct | 2 ms | 708 KB | Output is correct |
5 | Correct | 2 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 4 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 344 KB | Output is correct |
2 | Correct | 4 ms | 456 KB | Output is correct |
3 | Correct | 2 ms | 452 KB | Output is correct |
4 | Correct | 2 ms | 452 KB | Output is correct |
5 | Correct | 2 ms | 344 KB | Output is correct |
6 | Correct | 2 ms | 344 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 3 ms | 344 KB | Output is correct |
3 | Correct | 3 ms | 452 KB | Output is correct |
4 | Correct | 2 ms | 700 KB | Output is correct |
5 | Correct | 3 ms | 452 KB | Output is correct |
6 | Correct | 2 ms | 448 KB | Output is correct |
7 | Correct | 4 ms | 452 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 344 KB | Output is correct |
2 | Correct | 3 ms | 340 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 1 ms | 712 KB | Output is correct |
5 | Correct | 3 ms | 448 KB | Output is correct |
6 | Correct | 2 ms | 448 KB | Output is correct |
7 | Correct | 3 ms | 448 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 344 KB | Output is correct |
2 | Correct | 3 ms | 344 KB | Output is correct |
3 | Correct | 3 ms | 708 KB | Output is correct |
4 | Correct | 3 ms | 452 KB | Output is correct |
5 | Correct | 3 ms | 600 KB | Output is correct |
6 | Correct | 2 ms | 704 KB | Output is correct |
7 | Correct | 2 ms | 448 KB | Output is correct |