# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1045386 |
2024-08-05T22:36:24 Z |
beaconmc |
Simurgh (IOI17_simurgh) |
C++14 |
|
3000 ms |
15380 KB |
#include "simurgh.h"
#include <bits/stdc++.h>
typedef int ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
using namespace std;
bool visited[1000];
vector<array<ll,2>> edges[1000];
ll N;
vector<ll> ans;
void dfs(ll a, ll p){
for (auto&i : edges[a]){
if (i[0] != p && visited[i[0]] == 0){
visited[i[0]] = 1;
ans.push_back(i[1]);
dfs(i[0], p);
}
}
}
vector<int> find_roads(int n, vector<int> u, vector<int> v) {
FOR(i,0,u.size()){
edges[u[i]].push_back({v[i],i});
edges[v[i]].push_back({u[i],i});
}
set<ll> realans;
FOR(i,0,n){
FOR(p,0,1000) visited[p] = 0;
ans.clear();
if (i==0) visited[1]=1,dfs(1,i);
else visited[0]=1,dfs(0,i);
if (ans.size() == n-2){
vector<array<ll,2>> idk;
for (auto&j : edges[i]){
ans.push_back(j[1]);
ll sus = count_common_roads(ans);
idk.push_back({sus, j[1]});
ans.pop_back();
}
sort(idk.begin(), idk.end());
for (auto&i : idk) if (i[0] == idk[idk.size()-1][0]) realans.insert(i[1]);
}
}
vector<ll> temp;
for (auto&i : realans) temp.push_back(i);
if (temp.size() != n-1){
FOR(i,0,1000000000) cout << "NYA" << endl;
}
return temp;
}
Compilation message
simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:7:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
7 | #define FOR(i,x,y) for(ll i=x; i<y; i++)
......
34 | FOR(i,0,u.size()){
| ~~~~~~~~~~~~
simurgh.cpp:34:2: note: in expansion of macro 'FOR'
34 | FOR(i,0,u.size()){
| ^~~
simurgh.cpp:47:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
47 | if (ans.size() == n-2){
| ~~~~~~~~~~~^~~~~~
simurgh.cpp:65:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
65 | if (temp.size() != n-1){
| ~~~~~~~~~~~~^~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
correct |
2 |
Correct |
0 ms |
348 KB |
correct |
3 |
Correct |
0 ms |
348 KB |
correct |
4 |
Correct |
0 ms |
348 KB |
correct |
5 |
Correct |
0 ms |
348 KB |
correct |
6 |
Correct |
0 ms |
348 KB |
correct |
7 |
Correct |
1 ms |
348 KB |
correct |
8 |
Correct |
0 ms |
348 KB |
correct |
9 |
Correct |
0 ms |
348 KB |
correct |
10 |
Correct |
0 ms |
348 KB |
correct |
11 |
Execution timed out |
3067 ms |
15380 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
correct |
2 |
Correct |
0 ms |
348 KB |
correct |
3 |
Correct |
0 ms |
348 KB |
correct |
4 |
Correct |
0 ms |
348 KB |
correct |
5 |
Correct |
0 ms |
348 KB |
correct |
6 |
Correct |
0 ms |
348 KB |
correct |
7 |
Correct |
1 ms |
348 KB |
correct |
8 |
Correct |
0 ms |
348 KB |
correct |
9 |
Correct |
0 ms |
348 KB |
correct |
10 |
Correct |
0 ms |
348 KB |
correct |
11 |
Execution timed out |
3067 ms |
15380 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
correct |
2 |
Correct |
0 ms |
348 KB |
correct |
3 |
Correct |
0 ms |
348 KB |
correct |
4 |
Correct |
0 ms |
348 KB |
correct |
5 |
Correct |
0 ms |
348 KB |
correct |
6 |
Correct |
0 ms |
348 KB |
correct |
7 |
Correct |
1 ms |
348 KB |
correct |
8 |
Correct |
0 ms |
348 KB |
correct |
9 |
Correct |
0 ms |
348 KB |
correct |
10 |
Correct |
0 ms |
348 KB |
correct |
11 |
Execution timed out |
3067 ms |
15380 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
correct |
2 |
Correct |
0 ms |
348 KB |
correct |
3 |
Incorrect |
51 ms |
3404 KB |
WA in grader: NO |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
correct |
2 |
Correct |
0 ms |
348 KB |
correct |
3 |
Correct |
0 ms |
348 KB |
correct |
4 |
Correct |
0 ms |
348 KB |
correct |
5 |
Correct |
0 ms |
348 KB |
correct |
6 |
Correct |
0 ms |
348 KB |
correct |
7 |
Correct |
1 ms |
348 KB |
correct |
8 |
Correct |
0 ms |
348 KB |
correct |
9 |
Correct |
0 ms |
348 KB |
correct |
10 |
Correct |
0 ms |
348 KB |
correct |
11 |
Execution timed out |
3067 ms |
15380 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |