제출 #590036

#제출 시각아이디문제언어결과실행 시간메모리
590036almothana05기지국 (IOI20_stations)C++14
0 / 100
877 ms728 KiB
#include "stations.h" #include <vector> #include <bits/stdc++.h> using namespace std; vector<int> gr[2000] , num ; int vis[2000]; int pl = -1; void dfs(int x , int cmp){ vis[x] = 1; // cout << x << ' ' << cmp << "\n"; pl++; assert(pl > -1); 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++; if(cmp == 1){ num[x] = pl; } } vector<int> label(int menge, int maxi, vector<int> u, vector<int> v) { 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); } } 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]; } }

컴파일 시 표준 에러 (stderr) 메시지

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:17:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for(int i = 0 ; i< gr[x].size() ; i++){
      |                  ~^~~~~~~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:52:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |   for(int i = 0 ; i < c.size() - 1 ; i++){
      |                   ~~^~~~~~~~~~~~~~
stations.cpp:63:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |   for(int i = 1 ; i < c.size() - 1 ; i++){
      |                   ~~^~~~~~~~~~~~~~
stations.cpp:49:16: warning: unused variable 'erg' [-Wunused-variable]
   49 |  int be , en , erg = -1;
      |                ^~~
#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...