# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
284890 | mohammad | Simurgh (IOI17_simurgh) | C++14 | 1 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "simurgh.h"
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
// #define int long long
typedef long long ll ;
const ll ooo = 1e14 ;
const ll oo = 2e9 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7 ;
const int N = 10000010 ;
vector<pair<int , int>> g[501];
vector<int> r , ans;
int sz = 0 , vis[501];
void dfs(int u){
cout << u << ' ' << r.size() << endl;
vis[u] = 1;
if(r.size() == sz - 1){
int common = count_common_roads(r);
cout << common << endl;
if(common == sz - 1) ans = r;
return;
}
for(auto v : g[u]){
if(ans.size()) return;
if(!vis[v.first]){
r.push_back(v.second);
dfs(v.first);
r.erase(r.begin() + r.size() - 1);
}
}
vis[u]= 0 ;
}
vector<int> find_roads(int n, vector<int> u, vector<int> v) {
sz = n;
int m = u.size();
for(int i = 0 ; i < m ; ++i){
g[u[i]].push_back({v[i] , i});
g[v[i]].push_back({u[i] , i});
r = vector<int>(n - 1 , i);
if(count_common_roads(r) == n - 1) return r;
}
// dfs(0);
// for(auto x : ans) cout << x << ' '; cout << endl;
// for(int i = 0 ; i < n - 1 ; ++i) ans.push_back(0);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |