제출 #423972

#제출 시각아이디문제언어결과실행 시간메모리
423972schseSplit the Attractions (IOI19_split)C++17
18 / 100
112 ms15268 KiB
#include "split.h" #include <bits/stdc++.h> #ifndef EVAL #include "grader.cpp" #endif using namespace std; struct node { vector<int> edges; bool been; }; vector<int> res; vector<int> order; vector<node> g; int A, B, C; void dfs(int n) { if (g[n].been) return; order.push_back(n); g[n].been = true; for (int i : g[n].edges) dfs(i); return; } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { A = a, B = b, C = c; g.resize(n); res.resize(n); for (int i = 0; i < p.size(); i++) { g[p[i]].edges.push_back(q[i]); g[q[i]].edges.push_back(p[i]); } int stp = 0; for (stp = 0; stp < n; stp++) { if (g[stp].edges.size() == 1) { dfs(stp); break; } } if (stp == n) dfs(0); stp = 0; while (a--) { res[order[stp]] = 1; stp++; } while (b--) { res[order[stp]] = 2; stp++; } while (c--) { res[order[stp]] = 3; stp++; } return res; }

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

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