Submission #169931

#TimeUsernameProblemLanguageResultExecution timeMemory
169931sochoSplit the Attractions (IOI19_split)C++14
0 / 100
1145 ms1048580 KiB
#include "bits/stdc++.h" #include "split.h" using namespace std; int A, B, C, N; const int MXN = 100005; vector<int> adj[MXN]; int res[MXN]; vector<int> order; void dfsord(int node, int last) { order.push_back(node); for (int i=0; i<adj[node].size(); i++) { int ot = adj[node][i]; if (ot == last) continue; dfsord(ot, node); return; } } void line(int end) { dfsord(end, -1); } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { A = a; B = b; C = c; N = n; for (int i=0; i<p.size(); i++) { if (i == n - 1) continue; adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } int mn = 0; for (int i=0; i<n; i++) { if (adj[i].size() < adj[mn].size()) { mn = i; } } line(mn); vector<int> re; for (int i=0; i<n; i++) { if (i < a) re.push_back(1); else if (i - a < b) re.push_back(2); else re.push_back(3); } return re; }

Compilation message (stderr)

split.cpp: In function 'void dfsord(int, int)':
split.cpp:13:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=0; i<adj[node].size(); i++) {
                ~^~~~~~~~~~~~~~~~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:30:17: 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...