Submission #791018

# Submission time Handle Problem Language Result Execution time Memory
791018 2023-07-23T10:58:31 Z fatemetmhr Simurgh (IOI17_simurgh) C++17
13 / 100
14 ms 340 KB
//  ~ Be Name Khoda ~  //

#include "simurgh.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second

const int maxn  =  1e6   + 10;
const int maxn5 =  9;
const int maxnt =  1.2e6 + 10;
const int maxn3 =  1e3   + 10;
const int mod   =  1e9   + 7;
const ll  inf   =  1e18;

vector <int> adj[maxn5], av;
int cnt = 0;
bool mark[maxn5];

void dfs(int v){
	mark[v] = true;
	cnt++;
	for(auto u : adj[v]) if(!mark[u])
		dfs(u);
}

std::vector<int> find_roads(int n, std::vector<int> u, std::vector<int> v) {
	int m = u.size();
	for(int mask = 1; mask < (1 << m); mask++) if(__builtin_popcount(mask) == n - 1){
		for(int i = 0; i < n; i++)
			adj[i].clear();
		av.clear();
		for(int i = 0; i  < m; i++) if((mask >> i)&1){
			adj[u[i]].pb(v[i]);
			adj[v[i]].pb(u[i]);
			av.pb(i);
		}
		cnt = 0;
		memset(mark, false, sizeof mark);
		dfs(0);
		if(cnt == n){
			int val = count_common_roads(av);
			if(val == n - 1)
				return av;
		}
	}
	return av;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 296 KB correct
2 Correct 14 ms 296 KB correct
3 Correct 14 ms 292 KB correct
4 Correct 1 ms 212 KB correct
5 Correct 0 ms 212 KB correct
6 Correct 2 ms 212 KB correct
7 Correct 0 ms 212 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 0 ms 212 KB correct
10 Correct 1 ms 212 KB correct
11 Correct 0 ms 212 KB correct
12 Correct 1 ms 212 KB correct
13 Correct 6 ms 212 KB correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 296 KB correct
2 Correct 14 ms 296 KB correct
3 Correct 14 ms 292 KB correct
4 Correct 1 ms 212 KB correct
5 Correct 0 ms 212 KB correct
6 Correct 2 ms 212 KB correct
7 Correct 0 ms 212 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 0 ms 212 KB correct
10 Correct 1 ms 212 KB correct
11 Correct 0 ms 212 KB correct
12 Correct 1 ms 212 KB correct
13 Correct 6 ms 212 KB correct
14 Incorrect 0 ms 212 KB WA in grader: NO
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 296 KB correct
2 Correct 14 ms 296 KB correct
3 Correct 14 ms 292 KB correct
4 Correct 1 ms 212 KB correct
5 Correct 0 ms 212 KB correct
6 Correct 2 ms 212 KB correct
7 Correct 0 ms 212 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 0 ms 212 KB correct
10 Correct 1 ms 212 KB correct
11 Correct 0 ms 212 KB correct
12 Correct 1 ms 212 KB correct
13 Correct 6 ms 212 KB correct
14 Incorrect 0 ms 212 KB WA in grader: NO
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB correct
2 Runtime error 1 ms 340 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 296 KB correct
2 Correct 14 ms 296 KB correct
3 Correct 14 ms 292 KB correct
4 Correct 1 ms 212 KB correct
5 Correct 0 ms 212 KB correct
6 Correct 2 ms 212 KB correct
7 Correct 0 ms 212 KB correct
8 Correct 0 ms 212 KB correct
9 Correct 0 ms 212 KB correct
10 Correct 1 ms 212 KB correct
11 Correct 0 ms 212 KB correct
12 Correct 1 ms 212 KB correct
13 Correct 6 ms 212 KB correct
14 Incorrect 0 ms 212 KB WA in grader: NO
15 Halted 0 ms 0 KB -