제출 #289918

#제출 시각아이디문제언어결과실행 시간메모리
289918mohammadSplit the Attractions (IOI19_split)C++14
18 / 100
130 ms15732 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; #define endl "\n" // #define int long long typedef long long ll ; const ll ooo = 1e14 ; const ll oo = 2e9 ; const double PI = acos(-1) ; const ll M = 1e9 + 7 ; const int N = 10000010 ; int use[200010]; vector<int> v[200010] , seq; void dfs(int u ){ seq.push_back(u); use[u] = 1; for(auto x : v[u]) if(!use[x]){ dfs(x); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> res; int m = p.size(); for(int i = 0 ; i < m ; ++i) { v[p[i]].push_back(q[i]); v[q[i]].push_back(p[i]); } dfs(0); int x = 0 , y = 0 , sz = 0 , sz1 = 0 ; if(a >= max(b , c)) res = vector<int>(n , 1) , x = 3 , y = 2 , sz = c ,sz1 = b; else if(b >= c) res = vector<int>(n , 2) , x = 3 , y = 1 , sz = c ,sz1 = a; else res = vector<int>(n , 3) , x = 1 , y = 2 , sz = a ,sz1 = b; for(int i = 0 ; i < sz ; ++i) res[seq[i]] = x; reverse(seq.begin(), seq.end()); for(int i = 0 ; i < sz1 ; ++i) res[seq[i]] = y; return res; }
#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...