Submission #1040000

#TimeUsernameProblemLanguageResultExecution timeMemory
1040000LaMatematica14Split the Attractions (IOI19_split)C++17
0 / 100
42 ms12372 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> g(n, 3); vector<vector<int>> adj(n); for (int i = 0; i < p.size(); i++) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } queue<int> nx; nx.push(0); while (!nx.empty()) { int att = nx.front(); nx.pop(); for (int i : adj[att]) { if (b == 0) break; if (g[i] == 2) continue; nx.push(i); g[i] = 2; b--; } if (b == 0) break; } for (int i = 0; i < n; i++) { if (g[i] == 3) { g[i] = 1; break; } } return g; }

Compilation message (stderr)

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