제출 #143785

#제출 시각아이디문제언어결과실행 시간메모리
143785jwvg0425Split the Attractions (IOI19_split)C++17
11 / 100
130 ms10156 KiB
#include "split.h" #include <stdio.h> #include <vector> #include <queue> #include <algorithm> #include <iostream> #include <string> #include <bitset> #include <map> #include <set> #include <tuple> #include <string.h> #include <math.h> #include <random> #include <functional> #include <assert.h> #include <math.h> #define all(x) (x).begin(), (x).end() #define xx first #define yy second using namespace std; using i64 = long long int; using ii = pair<int, int>; using ii64 = pair<i64, i64>; vector<int> edge[100005]; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { for (int i = 0; i < p.size(); i++) { edge[p[i]].push_back(q[i]); edge[q[i]].push_back(p[i]); } vector<int> num(n, -1); queue<int> que; que.push(1); b--; num[1] = 2; while (!que.empty() && b > 0) { auto now = que.front(); que.pop(); for (auto& e : edge[now]) { if (num[e] != -1) continue; if (b == 0) break; num[e] = 2; que.push(e); b--; } } for (int i = 0; i < n; i++) { if (num[i] == -1) { num[i] = 1; break; } } for (int i = 0; i < n; i++) { if (num[i] == -1) num[i] = 3; } return num; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:31:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     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...