Submission #841828

#TimeUsernameProblemLanguageResultExecution timeMemory
841828manizareCop and Robber (BOI14_coprobber)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "coprobber.h" #define pb push_back #define F first #define S second #define all(a) a.begin(),a.end() #define pii pair<int,int> #define int long long using namespace std ; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int maxk=1002 , sq = 333 , lg = 20 , K = 0, inf = 1e18+10 , mod = 1e9 + 7 ; int cnt = 0 , n , dis[MAX_N] , par[MAX_N] , st[MAX_N] , en[MAX_N] , cur = 0 ;bool c[MAX_N][MAX_N] ; vector <int> G[MAX_N] ; void dfs(int v , int p = -1){ st[v] = cnt ; cnt++; for(int i =0 ; i < G[v].size() ; i++){ int u = G[v][i] ; if(u== p)continue ; dis[u] = dis[v] + 1; dfs(u , v) ; } en[v] = cnt ; cnt ++ ; } int start(int N , bool f[MAX_N][MAX_N]){ for(int i = 0 ; i < N ; i++){ for(int j =0 ; j < N; j++){ if(f[i][j])G[i].pb(j) ; } } n = N ; dfs(0) ; return 0; } int ch(int v , int u){ if(st[u] >= st[v] && en[v] >= en[u]){ return 1; } return 0 ; } int nextMove(int v){ if(dis[v]-1 == dis[cur])return cur ; for(int i =0 ; i < G[cur].size() ; i++){ int u = G[cur][i] ; if(ch(u, v) && ch(cur , u)){ cur = u; break ; } } return cur ; } /* signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int m ; cin >> n >>m ; for(int i =1;i <= m ; i++){ int v , u ; cin >> v >> u ; c[v][u] = c[u][v] = 1; } int cc = start(n , c) ; cout << cc << endl ;cout.flush(); cout.flush() ; if(cc == -1)return 0; while(1){ int t ; cin >> t; if(t == cc)return 0 ; cc = nextMove(t) ; cout << cc << endl ;cout.flush() ; } } */

Compilation message (stderr)

coprobber.cpp: In function 'void dfs(long long int, long long int)':
coprobber.cpp:18:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for(int i =0 ; i < G[v].size() ; i++){
      |                  ~~^~~~~~~~~~~~~
coprobber.cpp: In function 'long long int nextMove(long long int)':
coprobber.cpp:47:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |   for(int i =0 ; i < G[cur].size() ; i++){
      |                  ~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cc9QeXi5.o: in function `main':
grader.cpp:(.text.startup+0x16c): undefined reference to `start(int, bool (*) [500])'
/usr/bin/ld: grader.cpp:(.text.startup+0x2be): undefined reference to `nextMove(int)'
collect2: error: ld returned 1 exit status