Submission #134598

# Submission time Handle Problem Language Result Execution time Memory
134598 2019-07-23T05:19:00 Z dvdg6566 Simurgh (IOI17_simurgh) C++14
0 / 100
2 ms 380 KB
#include "simurgh.h"
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
#define pb emplace_back
#define mp make_pair
#define f first
#define s second
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(),x.end()
#define MAXN 241

int N,a,b;
vpi V[MAXN];
vpi edgeList;
vi res,cur;
vpi tmp;
int p[MAXN];

int par(int x){return (x==p[x])?x:p[x] = par(p[x]);}

std::vector<int> find_roads(int n, std::vector<int> u, std::vector<int> v) {
	N=n;
	for (int i=0;i<SZ(u);++i){
		a=u[i];b=v[i];
		V[a].pb(b,i);V[b].pb(a,i);
		edgeList.pb(a,b);
	}
	for (int i=0;i<N;++i){
		// We want to find all edges with index to a bigger node
		for (int j=0;j<N;++j)p[j]=j;
		cur.clear();
		tmp.clear();
		for (int j=0;j<SZ(edgeList);++j){
			pi it = edgeList[j];
			if (it.f == i || it.s == i)continue;
			if (par(it.f) == par(it.s))continue;
			p[par(it.f)] = par(it.s);
			cur.pb(j);
		}
		assert(SZ(cur) == N-2);
		// cout<<SZ(cur)<<'\n';
		for (auto x : V[i]){
			cur.pb(x.s);
			int t = count_common_roads(cur);
			tmp.pb(x.s,t);
			cur.pop_back();
		}
		int lowest = 1e9;
		for (auto x : tmp)lowest = min(lowest,x.s);
		for (auto x : tmp){
			if (x.s > lowest)res.pb(x.f);
		}
		// for (auto x:res)cout<<x<<' ';cout<<'\n';
	}
	sort(ALL(res));
	res.resize(unique(ALL(res)) - res.begin());
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB correct
2 Correct 2 ms 376 KB correct
3 Correct 2 ms 380 KB correct
4 Correct 2 ms 252 KB correct
5 Correct 2 ms 376 KB correct
6 Correct 2 ms 376 KB correct
7 Incorrect 2 ms 376 KB WA in grader: NO
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB correct
2 Correct 2 ms 376 KB correct
3 Correct 2 ms 380 KB correct
4 Correct 2 ms 252 KB correct
5 Correct 2 ms 376 KB correct
6 Correct 2 ms 376 KB correct
7 Incorrect 2 ms 376 KB WA in grader: NO
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB correct
2 Correct 2 ms 376 KB correct
3 Correct 2 ms 380 KB correct
4 Correct 2 ms 252 KB correct
5 Correct 2 ms 376 KB correct
6 Correct 2 ms 376 KB correct
7 Incorrect 2 ms 376 KB WA in grader: NO
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB correct
2 Correct 2 ms 376 KB correct
3 Correct 2 ms 380 KB correct
4 Correct 2 ms 252 KB correct
5 Correct 2 ms 376 KB correct
6 Correct 2 ms 376 KB correct
7 Incorrect 2 ms 376 KB WA in grader: NO
8 Halted 0 ms 0 KB -