제출 #44413

#제출 시각아이디문제언어결과실행 시간메모리
44413MatheusLealV사육제 (CEOI14_carnival)C++17
0 / 100
22 ms572 KiB
#include <bits/stdc++.h> #define N 200 #define MAX_SQRT 20 using namespace std; int cor[N], n, raiz, used[N], pai[N], peso[N], comprimir[N], cnt; vector< int > v [20]; int query(vector<int> v) { if(v.size() == 0) return 0; cout<<v.size()<<" "; for(auto x: v) cout<<x<<" "; cout<<endl; int k; cin>>k; return k; } int get(int ini, int fim) { if(fim < ini) swap(ini, fim); vector<int> vv; for(int i = ini; i <= fim; i++) vv.push_back(i); return query(vv); } int main() { cin>>n; raiz = ceil(sqrt(n)); //for(int i = 1; i <= n; i++) cin>>cor[i]; for(int i = 1; i < n; i ++) { if(!pai[i]) pai[i] = ++cnt; if( get(i, n) == get(i + 1, n)) { int ini = i + 1, fim = n, mid, best = i; while(fim >= ini) { mid = (ini + fim)/2; if( get(i, mid) == get(i + 1, mid)) { best = mid; fim = mid - 1; } else ini = mid + 1; } pai[best] = pai[i]; } } cout<<"0 "; for(int p = 1; p <= n; p++) cout<<pai[p]<<" "; cout<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...