#include "incursion.h"
#include <bits/stdc++.h>
using namespace std;
namespace asdf {
const int Nmax=45010;
int N;
vector<int> adj[Nmax], ret;
void DFS(int curr, int prev, int x) {
ret[curr-1]=x;
for(int next:adj[curr]) if(next!=prev) DFS(next, curr, x+1);
}
vector<int> mark(vector<pair<int, int>> F, int safe) {
N=F.size()+1;
for(int i=0; i<N-1; i++) adj[F[i].first].push_back(F[i].second), adj[F[i].second].push_back(F[i].first);
ret.resize(N);
DFS(safe, -1, 0);
return ret;
}
}
namespace qwer {
const int Nmax=45010;
int N;
vector<int> adj[Nmax];
void DFS(int curr, int prev, int val) {
for(int next:adj[curr]) if(next!=prev) {
int tmp=move(next);
if(!move(next)) return;
if(tmp<val) DFS(next, curr, tmp);
else move(curr);
}
}
void locate(vector<pair<int, int>> F, int curr, int t) {
N=F.size()+1;
for(int i=0; i<N-1; i++) adj[F[i].first].push_back(F[i].second), adj[F[i].second].push_back(F[i].first);
bool flag=true;
int val=0;
for(int next:adj[curr]) {
if(move(next)) {
move(curr);
flag=false; break;
}
val=move(curr);
}
if(flag) return;
DFS(curr, 0, val);
}
}
std::vector<int> mark(std::vector<std::pair<int, int>> F, int safe) {
asdf::mark(F, safe);
}
void locate(std::vector<std::pair<int, int>> F, int curr, int t) {
qwer::locate(F, curr, t);
}
Compilation message
incursion.cpp: In function 'std::vector<int> mark(std::vector<std::pair<int, int> >, int)':
incursion.cpp:53:1: warning: no return statement in function returning non-void [-Wreturn-type]
53 | }
| ^
interface.cpp: In function 'int main()':
interface.cpp:44:55: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
44 | if(fread(T.data(), sizeof(int), 2 * N - 2, stdin) != 2 * N - 2) exit(0);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
interface.cpp:50:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
50 | int l = (numbers.size() == N ? N : 0);
| ~~~~~~~~~~~~~~~^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
4696 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
47 ms |
11848 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
37 ms |
9272 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
4696 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |