#include "incursion.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define all(x) (x).begin(), (x).end()
vector<int> mark(vector<pair<int, int>> f, int safe) {
vector<vector<int>> adj(f.size()+1, vector<int>(0));
vector<int> ans(f.size()+1, -1);
for(auto& u : f){
u.F--; u.S--;
adj[u.F].pb(u.S);
adj[u.S].pb(u.F);
}
ans.assign(f.size()+1, -1);
safe--;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q;
q.push({0, safe});
ans[safe]=0;
while(!q.empty()){
int nw=q.top().S;
if(ans[nw]<q.top().F){
q.pop();
continue;
}
q.pop();
for(auto& u : adj[nw]){
if(ans[u]==-1 || ans[u]>ans[nw]+1){
ans[u]=ans[nw]+1;
q.push({ans[u], u});
}
}
}
for(auto& u : ans) u%=3;
ans[safe]=3;
return ans;
}
void locate(vector<pair<int, int>> f, int curr, int t) {
map<int, int> mp={{0, 2}, {1, 0}, {2, 1}};
vector<vector<int>> adj(f.size()+1, vector<int>(0));
vector<bool> vist(f.size()+1, 0);
for(auto& u : f){
u.F--; u.S--;
adj[u.F].pb(u.S);
adj[u.S].pb(u.F);
}
curr--;
int lst=curr, lstdeg=t;
for(auto& u : adj[curr]){
if(vist[u]) continue;
lst=curr;
lstdeg=t;
t=visit(u+1);
curr=u;
break;
}
while(t!=3){
vist[curr]=1;
if(t!=mp[lstdeg]){
for(auto& u : adj[curr]){
vist[u]=1;
}
t=visit(lst+1);
curr=lst;
}
for(auto& u : adj[curr]){
if(vist[u]) continue;
lst=curr;
lstdeg=t;
t=visit(u+1);
curr=u;
break;
}
}
return;
}
Compilation message
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);
| ~~~~~~~~~~~~~~~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
764 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
241 ms |
7156 KB |
Partially correct |
2 |
Partially correct |
203 ms |
7552 KB |
Partially correct |
3 |
Partially correct |
102 ms |
7000 KB |
Partially correct |
4 |
Partially correct |
99 ms |
7196 KB |
Partially correct |
5 |
Partially correct |
204 ms |
7508 KB |
Partially correct |
6 |
Partially correct |
72 ms |
7076 KB |
Partially correct |
7 |
Partially correct |
78 ms |
7068 KB |
Partially correct |
8 |
Partially correct |
196 ms |
7524 KB |
Partially correct |
9 |
Partially correct |
216 ms |
7508 KB |
Partially correct |
10 |
Partially correct |
139 ms |
7264 KB |
Partially correct |
11 |
Partially correct |
99 ms |
7004 KB |
Partially correct |
12 |
Partially correct |
287 ms |
7204 KB |
Partially correct |
13 |
Partially correct |
83 ms |
7240 KB |
Partially correct |
14 |
Partially correct |
84 ms |
7260 KB |
Partially correct |
15 |
Partially correct |
206 ms |
7196 KB |
Partially correct |
16 |
Partially correct |
200 ms |
7528 KB |
Partially correct |
17 |
Partially correct |
127 ms |
7324 KB |
Partially correct |
18 |
Partially correct |
82 ms |
7216 KB |
Partially correct |
19 |
Partially correct |
150 ms |
7260 KB |
Partially correct |
20 |
Partially correct |
81 ms |
7324 KB |
Partially correct |
21 |
Partially correct |
75 ms |
7068 KB |
Partially correct |
22 |
Partially correct |
200 ms |
7268 KB |
Partially correct |
23 |
Partially correct |
219 ms |
7272 KB |
Partially correct |
24 |
Partially correct |
99 ms |
7076 KB |
Partially correct |
25 |
Partially correct |
95 ms |
7416 KB |
Partially correct |
26 |
Partially correct |
83 ms |
7072 KB |
Partially correct |
27 |
Partially correct |
71 ms |
7000 KB |
Partially correct |
28 |
Partially correct |
77 ms |
7068 KB |
Partially correct |
29 |
Partially correct |
202 ms |
7244 KB |
Partially correct |
30 |
Partially correct |
200 ms |
7504 KB |
Partially correct |
31 |
Partially correct |
84 ms |
7280 KB |
Partially correct |
32 |
Partially correct |
229 ms |
7260 KB |
Partially correct |
33 |
Partially correct |
215 ms |
7268 KB |
Partially correct |
34 |
Partially correct |
81 ms |
7200 KB |
Partially correct |
35 |
Partially correct |
74 ms |
7072 KB |
Partially correct |
36 |
Partially correct |
205 ms |
7344 KB |
Partially correct |
37 |
Partially correct |
190 ms |
7364 KB |
Partially correct |
38 |
Partially correct |
257 ms |
7276 KB |
Partially correct |
39 |
Partially correct |
144 ms |
7188 KB |
Partially correct |
40 |
Partially correct |
204 ms |
7268 KB |
Partially correct |
41 |
Partially correct |
72 ms |
7076 KB |
Partially correct |
42 |
Partially correct |
75 ms |
7332 KB |
Partially correct |
43 |
Partially correct |
198 ms |
7564 KB |
Partially correct |
44 |
Partially correct |
205 ms |
7260 KB |
Partially correct |
45 |
Partially correct |
87 ms |
7068 KB |
Partially correct |
46 |
Partially correct |
75 ms |
7256 KB |
Partially correct |
47 |
Partially correct |
97 ms |
7076 KB |
Partially correct |
48 |
Partially correct |
78 ms |
7252 KB |
Partially correct |
49 |
Partially correct |
69 ms |
7192 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
74 ms |
6992 KB |
Partially correct |
2 |
Incorrect |
78 ms |
7068 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
764 KB |
Partially correct |
2 |
Partially correct |
241 ms |
7156 KB |
Partially correct |
3 |
Partially correct |
203 ms |
7552 KB |
Partially correct |
4 |
Partially correct |
102 ms |
7000 KB |
Partially correct |
5 |
Partially correct |
99 ms |
7196 KB |
Partially correct |
6 |
Partially correct |
204 ms |
7508 KB |
Partially correct |
7 |
Partially correct |
72 ms |
7076 KB |
Partially correct |
8 |
Partially correct |
78 ms |
7068 KB |
Partially correct |
9 |
Partially correct |
196 ms |
7524 KB |
Partially correct |
10 |
Partially correct |
216 ms |
7508 KB |
Partially correct |
11 |
Partially correct |
139 ms |
7264 KB |
Partially correct |
12 |
Partially correct |
99 ms |
7004 KB |
Partially correct |
13 |
Partially correct |
287 ms |
7204 KB |
Partially correct |
14 |
Partially correct |
83 ms |
7240 KB |
Partially correct |
15 |
Partially correct |
84 ms |
7260 KB |
Partially correct |
16 |
Partially correct |
206 ms |
7196 KB |
Partially correct |
17 |
Partially correct |
200 ms |
7528 KB |
Partially correct |
18 |
Partially correct |
127 ms |
7324 KB |
Partially correct |
19 |
Partially correct |
82 ms |
7216 KB |
Partially correct |
20 |
Partially correct |
150 ms |
7260 KB |
Partially correct |
21 |
Partially correct |
81 ms |
7324 KB |
Partially correct |
22 |
Partially correct |
75 ms |
7068 KB |
Partially correct |
23 |
Partially correct |
200 ms |
7268 KB |
Partially correct |
24 |
Partially correct |
219 ms |
7272 KB |
Partially correct |
25 |
Partially correct |
99 ms |
7076 KB |
Partially correct |
26 |
Partially correct |
95 ms |
7416 KB |
Partially correct |
27 |
Partially correct |
83 ms |
7072 KB |
Partially correct |
28 |
Partially correct |
71 ms |
7000 KB |
Partially correct |
29 |
Partially correct |
77 ms |
7068 KB |
Partially correct |
30 |
Partially correct |
202 ms |
7244 KB |
Partially correct |
31 |
Partially correct |
200 ms |
7504 KB |
Partially correct |
32 |
Partially correct |
84 ms |
7280 KB |
Partially correct |
33 |
Partially correct |
229 ms |
7260 KB |
Partially correct |
34 |
Partially correct |
215 ms |
7268 KB |
Partially correct |
35 |
Partially correct |
81 ms |
7200 KB |
Partially correct |
36 |
Partially correct |
74 ms |
7072 KB |
Partially correct |
37 |
Partially correct |
205 ms |
7344 KB |
Partially correct |
38 |
Partially correct |
190 ms |
7364 KB |
Partially correct |
39 |
Partially correct |
257 ms |
7276 KB |
Partially correct |
40 |
Partially correct |
144 ms |
7188 KB |
Partially correct |
41 |
Partially correct |
204 ms |
7268 KB |
Partially correct |
42 |
Partially correct |
72 ms |
7076 KB |
Partially correct |
43 |
Partially correct |
75 ms |
7332 KB |
Partially correct |
44 |
Partially correct |
198 ms |
7564 KB |
Partially correct |
45 |
Partially correct |
205 ms |
7260 KB |
Partially correct |
46 |
Partially correct |
87 ms |
7068 KB |
Partially correct |
47 |
Partially correct |
75 ms |
7256 KB |
Partially correct |
48 |
Partially correct |
97 ms |
7076 KB |
Partially correct |
49 |
Partially correct |
78 ms |
7252 KB |
Partially correct |
50 |
Partially correct |
69 ms |
7192 KB |
Partially correct |
51 |
Partially correct |
74 ms |
6992 KB |
Partially correct |
52 |
Incorrect |
78 ms |
7068 KB |
Not correct |
53 |
Halted |
0 ms |
0 KB |
- |