제출 #804614

#제출 시각아이디문제언어결과실행 시간메모리
804614farukSplit the Attractions (IOI19_split)C++17
18 / 100
81 ms16064 KiB
#include "split.h" #include <bits/stdc++.h> #define mp make_pair #define all(a) a.begin(), a.end() using namespace std; typedef long long ll; typedef pair<int, int> pii; vector<vector<int> > graph; int n; vector<bool> visited; vector<int> vec; void dfs(int curr) { visited[curr] = true; vec.push_back(curr); for (int nei : graph[curr]) if (!visited[nei]) dfs(nei); } vector<int> get_order() { int s = 0; visited.resize(n); for (int i = 0; i < n; i++) if (graph[i].size() == 1) s = i; dfs(s); return vec; } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> res(n); ::n = n; graph.resize(n); for (int i = 0; i < p.size(); i++) { graph[p[i]].push_back(q[i]); graph[q[i]].push_back(p[i]); } vector<int> order = get_order(); for (int i = 0; i < a; i++) res[order[i]] = 1; for (int i = a; i < a+b; i++) res[order[i]] = 2; for (int i = a+b; i < a+b+c; i++) res[order[i]] = 3; return res; }

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

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