제출 #650012

#제출 시각아이디문제언어결과실행 시간메모리
650012alvinpiter열대 식물원 (Tropical Garden) (IOI11_garden)C++17
49 / 100
5038 ms5044 KiB
#include "garden.h" #include "gardenlib.h" #include<bits/stdc++.h> using namespace std; #define MAXN 150000 int P; vector<pair<int, int> > adj[MAXN + 3]; bool check(int u, int stepsLeft, int prevBeauty) { if (stepsLeft == 0) { return u == P; } int nextEdgeIdx = -1; for (int i = 0; i < adj[u].size(); i++) { auto [v, beauty] = adj[u][i]; if (beauty != prevBeauty) { if (nextEdgeIdx == -1 || beauty < adj[u][nextEdgeIdx].second) { nextEdgeIdx = i; } } } // If there is no other edge, take the last edge, which must be indexed 0. if (nextEdgeIdx == -1) { nextEdgeIdx = 0; } return check(adj[u][nextEdgeIdx].first, stepsLeft - 1, adj[u][nextEdgeIdx].second); } void count_routes(int n, int m, int p, int r[][2], int q, int g[]) { P = p; for (int i = 0; i < m; i++) { adj[r[i][0]].push_back({r[i][1], i}); adj[r[i][1]].push_back({r[i][0], i}); } for (int i = 0; i < q; i++) { int ans = 0; for (int startingFountain = 0; startingFountain < n; startingFountain++) { ans += check(startingFountain, g[i], -1); } answer(ans); } }

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

garden.cpp: In function 'bool check(int, int, int)':
garden.cpp:16:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |   for (int i = 0; i < adj[u].size(); i++) {
      |                   ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...