Submission #1014783

#TimeUsernameProblemLanguageResultExecution timeMemory
1014783alex_2008Split the Attractions (IOI19_split)C++14
0 / 100
1136 ms1048576 KiB
#include "split.h" #include <iostream> #include <cmath> #include <vector> #include <set> #include <map> #include <algorithm> #include <queue> using namespace std; typedef long long ll; const int N = 1e5 + 10, M = 110; vector <vector<int>> G; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { int m = (int)p.size(); bool sb1 = true, sb2 = true; G.resize(n); for (int i = 0; i < m; i++) { G[p[i]].push_back(q[i]); G[q[i]].push_back(p[i]); } for (int i = 0; i < n; i++) { if ((int)G[i].size() > 2) sb1 = false; } if (sb1) { int a = -1, b = -1; for (int i = 0; i < n; i++) { if ((int)G[i].size() == 1) { if (a == -1) a = i; else b = i; } } vector <int> v; v.push_back(a); v.push_back(G[a][0]); while (v.back() != b) { int a = v[(int)v.size() - 1]; int b = v[(int)v.size() - 2]; if (G[a][0] == b) v.push_back(G[a][1]); else v.push_back(G[a][0]); } vector <int> ans(n); for (int i = 0; i < n; i++) { if (i < a) ans[v[i]] = 1; else if (i < a + b) ans[v[i]] = 2; else ans[v[i]] = 3; } return ans; } } /*int main() { }*/

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:15:19: warning: unused variable 'sb2' [-Wunused-variable]
   15 |  bool sb1 = true, sb2 = true;
      |                   ^~~
split.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^
#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...