제출 #1228194

#제출 시각아이디문제언어결과실행 시간메모리
1228194arkanefuryCarnival (CEOI14_carnival)C++20
0 / 100
5 ms7492 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define in insert #define lb lower_bound #define F first #define S second #define sz size() #define int long long #define all(v) v.begin(),v.end() #define FOR1(x, n) for(int j = x; j <= n; j ++) #define FOR(x, n, m, d) for(int x = n; x <= m; x += d) #define FORR(x, n, m, d) for(int x = n; x >= m; x -= d) #define nikita ios_base::sync_with_stdio(0), cin.tie(0); const int N = 3e5+5; int a[N], b[N], pref[N], d[N],ans, inf = 1e18, p[N]; int n,m,k,sum=0,x,y, r, cnt, l, mod = 1e9+7; vector<int>g[N]; int par(int x){ if(x==p[x])return x; return par(p[x]); } void unite(int x, int y){ x = par(x), y = par(y); if(x < y)p[x] = y; else p[y] = x; } void solve() { nikita cin >> n; vector<int>v; FOR(i, 1, n, 1)p[i] = i; FOR(i, 1, n, 2){ cout << "2 " << i << ' ' << i+1 << endl; cin >> x; bool f = 0, ko = 0; if(x == 1){ ko = 1; unite(i, i+1); for(auto j : v){ cout << "2 " << j << ' ' << i << endl; cin >> x; if(x == 1){unite(j, i); f = 1; break;} } } else{ for(auto j : v){ if(!f){ cout << "2 " << j << ' ' << i << endl; cin >> x; if(x == 1)unite(j, i), f = 1; } if(!ko){ cout << "2 " << j << ' ' << i << endl; cin >> x; if(x == 1)unite(j, i),ko = 1; } } } if(!ko)v.pb(i+1); if(!f)v.pb(i); } cout << "0 "; FOR(i,1 , n, 1)cout << par(i) << ' '; return; } signed main(){ nikita int tt = 1; if(!tt)cin >> tt; FOR(i, 1, tt, 1)solve(); } /* dp[i][j] = min x, where last a[j] equal to x otherwise dp[i][j] = inf dp[1][1] = l[1]; for(i, 1, n, 1)dp[i][1] = l[i]; for(j, 1, n, 1)dp[i][j] = dp[i-1][j]; dp[i][j] <= dp[i][j+1] && dp[i][j] >= dp[i+1][j] for(j, 1, i-1, 1){ if(dp[i-1][j-1] <= r[i])dp[i][j] = min(dp[i][j], max(l[i], dp[i-1][j-1])) dp[i][j] = min(dp[i][j], dp[i-1][j-1]) } */
#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...