제출 #1024351

#제출 시각아이디문제언어결과실행 시간메모리
1024351Ahmed_Solyman기지국 (IOI20_stations)C++14
5 / 100
629 ms940 KiB
#include <bits/stdc++.h> using namespace std; #include "stations.h" #define loop(x, i) for (int i = 0; i < x; i++) #define pb push_back #define ALL(x) (x).begin(), (x).end() typedef vector<int> vi; typedef pair<int, int> ii; typedef set<int> si; typedef vector<vi> vvi; vvi adj; vi nrs; void DFS(int i, int prev = -1, int nr = 0) { if (nr > 1000) throw; nrs[i] = nr; for (int j : adj[i]) { if (prev == j) continue; DFS(j, i, nr + 1); } } vi label(int n, int k, vi u, vi v) { nrs = vi(n); adj = vvi(n); loop(u.size(), i) { adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } int start = 0; loop(n, i) { if (adj[i].size() == 1) { start = i; break; } } DFS(start); return nrs; } int find_next_station(int s, int t, vi c) { if (c.size() == 1) return c[0]; for (int l : c) if (l == t) return t; if (t > s) return c.back(); return c[0]; }

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

stations.cpp: In function 'vi label(int, int, vi, vi)':
stations.cpp:5:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define loop(x, i) for (int i = 0; i < x; i++)
......
   33 |  loop(u.size(), i)
      |                                       
stations.cpp:33:2: note: in expansion of macro 'loop'
   33 |  loop(u.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...