# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
579809 |
2022-06-19T23:57:31 Z |
peuch |
Game (APIO22_game) |
C++17 |
|
0 ms |
208 KB |
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int K;
vector<vector<int> > ar;
vector<int> pesado;
bool ans;
void dfs(int cur, int val){
if(pesado[cur] >= val) return;
pesado[cur] = val;
// printf("\tpesado[%d] = %d\n", cur, val);
if(cur < K && pesado[cur] >= cur) ans = false;
for(int i = 0; i < ar[cur].size(); i++){
int viz = ar[cur][i];
dfs(viz, val);
}
}
void init(int n, int k) {
K = k;
pesado = vector<int> (n, -1);
ar = vector<vector<int> > (n, vector<int> (0));
for(int i = 0; i < k; i++)
pesado[i] = i - 1, ar[i].push_back(i + 1);
ar[k - 1].clear();
ans = false;
}
int add_teleporter(int u, int v) {
// printf("%d -> %d\n", u, v);
if(ans) return ans;
ar[u].push_back(v);
if(u < K) dfs(v, max(u, pesado[u]));
else dfs(v, pesado[u]);
return ans;
}
Compilation message
game.cpp: In function 'void dfs(int, int)':
game.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | for(int i = 0; i < ar[cur].size(); i++){
| ~~^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |