Submission #579809

#TimeUsernameProblemLanguageResultExecution timeMemory
579809peuchGame (APIO22_game)C++17
0 / 100
0 ms208 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...