# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62076 | 2018-07-27T12:03:23 Z | bazsi700 | ICC (CEOI16_icc) | C++14 | 355 ms | 804 KB |
#include <bits/stdc++.h> #include "icc.h"; using namespace std; #define MOD 1000000007 #define ll long long int #define vi vector<int> #define vii vector< vector<int> > #define PI 3.1415926535897932384626433832795 #define INF 9223372036854775807LL //13:22 int root[105]; int findroot(int x) { if(root[x] != x) { root[x] = findroot(root[x]); } return root[x]; } void join(int a, int b) { if(rand()%2) { root[findroot(a)] = findroot(b); } else { root[findroot(b)] = findroot(a); } } void run(int n) { srand(42); for(int i = 1; i <= n; i++) { root[i] = i; } for(int i = 1; i < n; i++) { set<int> roots; vii inroot(n+1,vi()); set<int> gr; for(int i = 1; i <= n; i++) { roots.insert(root[i]); inroot[root[i]].push_back(i); gr.insert(i); } int xgr,ygr,x,y; for(int curr : roots) { int a[inroot[curr].size()]; int ind = 0; for(int el : inroot[curr]) { gr.erase(el); a[ind++] = el; } ind = 0; int b[n-inroot[curr].size()]; for(int el : gr) { b[ind++] = el; } int an = query(inroot[curr].size(),n-inroot[curr].size(),a,b); if(an == 1) { xgr = curr; break; } for(int el : inroot[curr]) { gr.insert(el); } } int ind = 0; int b[n-inroot[xgr].size()]; for(int el : gr) { b[ind++] = el; } for(auto posx : inroot[xgr]) { int a[1]; a[0] = posx; int an = query(1,n-inroot[xgr].size(),a,b); if(an) { x = posx; break; } } for(auto posy : gr) { int bb[1]; int a[1]; a[0] = x; bb[0] = posy; int an = query(1,1,a,bb); if(an) { y = posy; break; } } join(x,y); setRoad(x,y); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 504 KB | Wrong road! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 48 ms | 616 KB | Wrong road! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 53 ms | 700 KB | Wrong road! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 118 ms | 740 KB | Wrong road! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 157 ms | 780 KB | Wrong road! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 355 ms | 804 KB | Number of queries more than 3250 out of 1625 |
2 | Halted | 0 ms | 0 KB | - |