제출 #290558

#제출 시각아이디문제언어결과실행 시간메모리
290558jairRSSplit the Attractions (IOI19_split)C++17
0 / 100
2056 ms1048580 KiB
#include "split.h" using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; vvi adj; vi degree; int ga, gb, gc; vector<bool> visited; void dfs(int src, int prev = -1) { if (gc > 0) { degree[src] = 3; gc--; } else if (gb > 0) { degree[src] = 2; gb--; } else if (ga > 0) { degree[src] = 1; ga--; } visited[src] = true; for (int a : adj[src]) if (a != prev) dfs(a, src); } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { ga = a; gb = b; gc = c; visited = vector<bool>(n); degree = vi(n, 0); adj = vvi(n); for (int i = 0; i < p.size(); i++) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); degree[p[i]]++; degree[q[i]]++; } for (int i = 0; i < n; i++) { if (degree[i] != 1 && !visited[i]) continue; dfs(i); } return degree; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:43:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |  for (int i = 0; i < p.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...