# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1076840 |
2024-08-26T17:10:09 Z |
vjudge1 |
Simurgh (IOI17_simurgh) |
C++17 |
|
188 ms |
348 KB |
#include "simurgh.h"
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef pair<char, int> ci;
typedef pair<string, int> si;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
#define pb push_back
#define fi first
#define se second
#define whole(v) v.begin(), v.end()
#define rwhole(v) v.rbegin(), v.rend()
#define inf INT_MAX/2
#define fro front
vii ed;
vi ans;
int N;
int p = 0;
void f(int i, vi x){
if(x.size() == N-1){
int arr[N];
memset(arr, 0, sizeof arr);
for(auto e:x){
if(arr[ed[e].fi] == 1 && arr[ed[e].se] == 1){
return;
}
arr[ed[e].fi] = 1;
arr[ed[e].se] = 1;
}
for(auto e:arr){
if(e == 0){
return ;
}
}
int g = count_common_roads(x);
if(g == N-1){
ans = x;
return ;
}
}
if(p == i){
return ;
}
f(i+1, x);
x.push_back(i);
f(i+1, x);
}
std::vector<int> find_roads(int n, std::vector<int> u, std::vector<int> v) {
N = n;
p = u.size();
for(int i = 0; i < u.size(); ++i){
ed.pb(ii(v[i], u[i]));
}
vi x;
f(0, x);
return ans;
}
Compilation message
simurgh.cpp: In function 'void f(int, vi)':
simurgh.cpp:30:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
30 | if(x.size() == N-1){
| ~~~~~~~~~^~~~~~
simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:63:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
63 | for(int i = 0; i < u.size(); ++i){
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
344 KB |
correct |
2 |
Incorrect |
10 ms |
348 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
344 KB |
correct |
2 |
Incorrect |
10 ms |
348 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
344 KB |
correct |
2 |
Incorrect |
10 ms |
348 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
correct |
2 |
Incorrect |
188 ms |
348 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
344 KB |
correct |
2 |
Incorrect |
10 ms |
348 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |