Submission #521008

#TimeUsernameProblemLanguageResultExecution timeMemory
521008Valaki2Split the Attractions (IOI19_split)C++14
7 / 100
61 ms9512 KiB
#include "split.h" using namespace std; #include <iostream> /* 10 9 3 5 2 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 0 */ vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> res(n, 3); vector<vector<int> > g(n); for(int i = 0; i < p.size(); i++) { g[p[i]].push_back(q[i]); g[q[i]].push_back(p[i]); } bool volt = false; for(int i = 0; i < n; i++) { if(g[i].size() == 1) { volt = true; int x = i, y = -1; for(int j = 0; j < a; j++) { res[x] = 1; int temp = x; if(g[x][0] == y) { x = g[x][1]; } else { x = g[x][0]; } y = temp; } for(int j = 0; j < b; j++) { res[x] = 2; int temp = x; if(g[x][0] == y) { x = g[x][1]; } else { x = g[x][0]; } y = temp; } break; } } if(!volt) { int x = 0, y = -1; for(int j = 0; j < a; j++) { res[x] = 1; int temp = x; if(g[x][0] == y) { x = g[x][1]; } else { x = g[x][0]; } y = temp; } for(int j = 0; j < b; j++) { res[x] = 2; int temp = x; if(g[x][0] == y) { x = g[x][1]; } else { x = g[x][0]; } y = temp; } } /*if (n == 9) { res = {1, 1, 3, 1, 2, 2, 3, 1, 3}; } else { res = {0, 0, 0, 0, 0, 0}; }*/ return res; }

Compilation message (stderr)

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