# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1079014 |
2024-08-28T09:26:28 Z |
Gray |
Simurgh (IOI17_simurgh) |
C++17 |
|
3 ms |
436 KB |
#include "simurgh.h"
#include <bits/stdc++.h>
using namespace std;
#define ll int
#define ff first
#define ss second
#define ln "\n"
#define ld long double
vector<pair<ll, ll>> e;
vector<vector<ll>> A;
ll n, m;
// Fast version
vector<ll> ans;
void dfs(ll u, vector<bool> &vis, vector<ll> &cur, ll lev){
vis[u]=1;
if (lev==n){
ll res=count_common_roads(cur);
// cout << e[cur[0]].ff << " ";
// for (auto ch:cur) cout << e[ch].ss << ' ';
// cout << " : ";
// cout << res << ln;
if (res==n-1) {ans=cur; return;}
}
for (auto i:A[u]){
ll v = e[i].ff^e[i].ss^u;
if (!vis[v]){
cur.push_back(i);
dfs(v, vis, cur, lev+1);
cur.pop_back();
if (ans.size()) return;
}
}
vis[u]=0;
}
vector<int> find_roads(int _n, vector<int> u, vector<int> v) {
n=_n; m=u.size();
e.resize(m); A.clear(); A.resize(n);
for (ll i=0; i<m; i++){
e[i]={u[i], v[i]};
A[u[i]].push_back(i); A[v[i]].push_back(i);
}
vector<bool> vis(n);
vector<ll> cur;
for (ll i=0; i<n and !ans.size(); i++){
vis.assign(n, 0); cur.clear();
dfs(i, vis, cur, 1);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
correct |
2 |
Incorrect |
3 ms |
436 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |