# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169817 | 2019-12-22T23:46:18 Z | arthur_nascimento | Split the Attractions (IOI19_split) | C++14 | 46 ms | 7032 KB |
#include "split.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define debug #define ll long long #define maxn 2525 #define pii pair<int,int> using namespace std; int sz[3]; int id0,id1,id2; int ans[maxn]; vector<int> L[maxn]; int vis[maxn]; int color(int vx,int qtd,int to){ //qtd--; //ans[vx] = to; debug("+%d\n",vx); queue<int> Q; Q.push(vx); vis[vx] = 1; while(qtd){ int nov = Q.front(); Q.pop(); ans[nov] = to;debug("+%d\n",nov); qtd--; for(int i=0;i<L[nov].size();i++){ int yy = L[nov][i]; if(!vis[yy]){ vis[yy] = 1; debug("push %d\n",yy); Q.push(yy); } } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { sz[0] = a; sz[1] = b; sz[2] = c; for(int i=0;i<p.size();i++) L[p[i]].pb(q[i]), L[q[i]].pb(p[i]); vector<pii> vv; for(int i=0;i<3;i++){ vv.pb(pii(sz[i],i)); } sort(vv.begin(),vv.end()); id0 = vv[0].second; id1 = vv[1].second; id2 = vv[2].second; for(int i=0;i<n;i++) ans[i] = id2+1; if(sz[id0] == 1){ color(0,sz[id1],id1+1); for(int i=0;i<n;i++) if(ans[i] == id2+1){ ans[i] = id0+1; break; } } vector<int> res; for(int i=0;i<n;i++) res.pb(ans[i]); return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | ok, correct split |
2 | Correct | 2 ms | 380 KB | ok, correct split |
3 | Correct | 2 ms | 376 KB | ok, correct split |
4 | Correct | 2 ms | 376 KB | ok, correct split |
5 | Correct | 2 ms | 376 KB | ok, correct split |
6 | Incorrect | 2 ms | 376 KB | invalid split: #1=0, #2=0, #3=100 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | ok, correct split |
2 | Correct | 2 ms | 376 KB | ok, correct split |
3 | Correct | 2 ms | 376 KB | ok, correct split |
4 | Runtime error | 46 ms | 7032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | ok, correct split |
2 | Runtime error | 32 ms | 4984 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | invalid split: #1=9, #2=0, #3=0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | ok, correct split |
2 | Correct | 2 ms | 380 KB | ok, correct split |
3 | Correct | 2 ms | 376 KB | ok, correct split |
4 | Correct | 2 ms | 376 KB | ok, correct split |
5 | Correct | 2 ms | 376 KB | ok, correct split |
6 | Incorrect | 2 ms | 376 KB | invalid split: #1=0, #2=0, #3=100 |
7 | Halted | 0 ms | 0 KB | - |