제출 #287755

#제출 시각아이디문제언어결과실행 시간메모리
287755Haunted_CppSplit the Attractions (IOI19_split)C++17
11 / 100
127 ms14456 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; const int MAX_N = 1e5 + 5; bool vis[MAX_N]; vector<vector<int>> g(MAX_N); vector<int> euler; vector<int> ans; int k; void dfs(int node) { vis[node] = true; if (euler.size() < k) euler.emplace_back(node); for (auto to : g[node]) { if (!vis[to]) { vis[to] = true; dfs(to); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> in(n); k = b; ans = vector<int>(n, -1); const int m = p.size(); memset(vis, false, sizeof(vis)); for (int i = 0; i < m; i++) { int st = p[i]; int et = q[i]; g[st].emplace_back(et); g[et].emplace_back(st); } dfs(0); assert(euler.size() == b); for (auto to : euler) { ans[to] = 2; } for (int i = 0; i < n; i++) { if (ans[i] == -1) { if (a) { --a; ans[i] = 1; } else { ans[i] = 3; } } } return ans; }

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

split.cpp: In function 'void dfs(int)':
split.cpp:19:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |   if (euler.size() < k) euler.emplace_back(node);
      |       ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from split.cpp:2:
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:41:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |   assert(euler.size() == b);
      |          ~~~~~~~~~~~~~^~~~
#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...