Submission #590105

#TimeUsernameProblemLanguageResultExecution timeMemory
590105almothana05Stations (IOI20_stations)C++14
Compilation error
0 ms0 KiB
#include "stations.h"#include <vector>#include <bits/stdc++.h>using namespace std;vector<int> gr[2000] , num , de ;int vis[2000];int pl = -1;void dfs(int x , int cmp){ de.push_back(x); vis[x] = 1; // cout << x << ' ' << cmp << "\n"; pl++; if(cmp == 0){ num[x] = pl; } // cout << 1 << ' '; for(int i = 0 ; i< gr[x].size() ; i++){ int kind = gr[x][i]; if(vis[kind] == 0){ dfs(kind , cmp ^ 1); } } pl++; // assert(pl > 0); if(cmp == 1){ num[x] = pl; } while(num[x] == -1);}vector<int> label(int menge, int maxi, vector<int> u, vector<int> v) { num.clear(); de.clear(); for(int i = 0 ; i < 1000 ; i++){ gr[i].clear(); vis[i] = 0; } pl = -1; num.resize(menge , -1); for(int i = 0 ; i < menge - 1 ; i++){ gr[u[i]].push_back(v[i]); gr[v[i]].push_back(u[i]); } for(int i = 0 ; i < menge ; i++){ if(vis[i] == 0){ dfs(i , 0); } // while(num[i] == -1); } assert(de.size() == menge); for(int i = 0 ; i < menge ; i++){ // cout << num[i] << ' '; // assert(num[i] >= 0); } // cout << "\n"; return num;} int find_next_station(int s, int t, vector<int> c) { int be , en , erg = -1; if(s < c[0]){ be = s; for(int i = 0 ; i < c.size() - 1 ; i++){ en = c[i]; if(be <= t && t <= en){ return c[i]; } be = c[i]; } return c[c.size() - 1]; } else{ c.push_back(s); for(int i = 1 ; i < c.size() - 1 ; i++){ be = c[i]; en = c[i + 1] - 1; if(be <= t && t <= en){ return c[i]; } } return c[0]; }}

Compilation message (stderr)

stations.cpp:1:22: warning: extra tokens at end of #include directive
    1 | #include "stations.h"#include <vector>#include <bits/stdc++.h>using namespace std;vector<int> gr[2000] , num , de ;int vis[2000];int pl = -1;void dfs(int x , int cmp){ de.push_back(x); vis[x] = 1; // cout << x << ' ' << cmp << "\n"; pl++; if(cmp == 0){  num[x] = pl; }  // cout << 1 << ' '; for(int i = 0 ; i< gr[x].size() ; i++){  int kind = gr[x][i];  if(vis[kind] == 0){   dfs(kind , cmp ^ 1);  } } pl++; // assert(pl > 0);  if(cmp == 1){  num[x] = pl; } while(num[x] == -1);}vector<int> label(int menge, int maxi, vector<int> u, vector<int> v) { num.clear(); de.clear(); for(int i = 0 ; i < 1000 ; i++){  gr[i].clear();  vis[i] = 0; } pl = -1; num.resize(menge , -1); for(int i = 0 ; i < menge - 1 ; i++){  gr[u[i]].push_back(v[i]);  gr[v[i]].push_back(u[i]); } for(int i = 0 ; i < menge ; i++){  if(vis[i] == 0){   dfs(i , 0);  }  // while(num[i] == -1); } assert(de.size() == menge); for(int i = 0 ; i < menge ; i++){  // cout << num[i] << ' ';  // assert(num[i] >= 0); } // cout << "\n"; return num;} int find_next_station(int s, int t, vector<int> c) { int be , en , erg = -1; if(s < c[0]){  be = s;  for(int i = 0 ; i < c.size() - 1 ; i++){   en = c[i];   if(be <= t && t <= en){    return c[i];   }   be = c[i];  }  return c[c.size() - 1]; } else{  c.push_back(s);  for(int i = 1 ; i < c.size() - 1 ; i++){   be = c[i];   en = c[i + 1] - 1;   if(be <= t && t <= en){    return c[i];   }  }  return c[0]; }}
      |                      ^
/usr/bin/ld: /tmp/ccSvARZV.o: in function `main':
stub.cpp:(.text.startup+0x2b5): undefined reference to `label(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: stub.cpp:(.text.startup+0x4cc): undefined reference to `find_next_station(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status