# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
285445 | 2020-08-29T02:31:31 Z | DanerZein | Split the Attractions (IOI19_split) | C++14 | 77 ms | 9720 KB |
#include "split.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef pair<int,int> ii; vector<vi> G; int vis[100010]; bool sw=0; int ca; void dfs(int u,int c){ if(ca<=0){ sw=1; return; } ca--; vis[u]=c; for(auto &v:G[u]){ if(vis[v]==-1){ dfs(v,c); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { G.resize(n+1); for(int i=0;i<p.size();i++){ G[p[i]].push_back(q[i]); G[q[i]].push_back(p[i]); } vector<ii> aux; aux.push_back(ii(a,1)); aux.push_back(ii(b,2)); aux.push_back(ii(c,3)); sort(aux.begin(),aux.end()); int id; for(int i=0;i<G.size();i++){ if(G[i].size()==1){ id=i; break; } } memset(vis,-1,sizeof vis); ca=aux[0].first; dfs(id,aux[0].second); /*cout<<id<<" "<<aux[0].second<<" "<<aux[0].first-1<<endl; for(int i=0;i<n;i++){ cout<<vis[i]<<" "; } cout<<endl;*/ bool res=0; if(sw==0){ res=1; } for(int i=0;i<n;i++){ if(vis[i]==-1){ sw=0; ca=aux[1].first; //cout<<ca<<endl; dfs(i,aux[1].second); break; } } if(sw==0){ res=1; } vector<int> r; if(res==1){ for(int i=0;i<n;i++){ r.push_back(0); } } else{ for(int i=0;i<n;i++){ if(vis[i]==-1){ r.push_back(aux[2].second); } else{ r.push_back(vis[i]); } } } return r; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 640 KB | ok, correct split |
2 | Incorrect | 1 ms | 768 KB | jury found a solution, contestant did not |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 768 KB | ok, correct split |
2 | Incorrect | 1 ms | 768 KB | jury found a solution, contestant did not |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 768 KB | ok, correct split |
2 | Incorrect | 77 ms | 9720 KB | jury found a solution, contestant did not |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 768 KB | jury found a solution, contestant did not |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 640 KB | ok, correct split |
2 | Incorrect | 1 ms | 768 KB | jury found a solution, contestant did not |
3 | Halted | 0 ms | 0 KB | - |