제출 #1040037

#제출 시각아이디문제언어결과실행 시간메모리
1040037LaMatematica14Split the Attractions (IOI19_split)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; vector<int> sz, pr; vector<vector<int>> adj; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { array<pair<int, int>, 3> t; t[0] = {a, 1}; t[1] = {b, 2}; t[2] = {c, 3}; sort(t.begin(), t.end()); sz.resize(n); pr.resize(n); adj.resize(n); vector<int> g(n, 0); for (int i = 0; i < p.size(); i++) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } int beg = 0; for (int i = 0; i < n; i++) { if (adj[i].size() == 1) beg = i; } for (int i = 0; i < n; i++) { for (int x : adj[beg]) { if (g[x] > 0) continue; if (t[0].first > 0) { g[x] = t[0].second; t[0].first--; } else if (t[1].first > 0) { g[x] = t[1].second; t[1].first--; } else { g[x] = t[2].second; t[2].first--; } beg = x; break; } } return g; }

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

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