Submission #1030738

#TimeUsernameProblemLanguageResultExecution timeMemory
1030738ZicrusSplit the Attractions (IOI19_split)C++17
7 / 100
44 ms9536 KiB
#include <bits/stdc++.h> #include "split.h" using namespace std; typedef long long ll; vector<vector<ll>> adj; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { int m = p.size(); vector<int> res(n); adj = vector<vector<ll>>(n); for (int i = 0; i < m; i++) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } ll lowDeg = 0, deg = n; for (int i = 0; i < n; i++) { if (adj[i].size() < deg) { lowDeg = i; deg = adj[i].size(); } } queue<ll> qu; qu.push(lowDeg); while (!qu.empty()) { ll node = qu.front(); qu.pop(); if (c) { res[node] = 3; c--; } else if (b) { res[node] = 2; b--; } else { res[node] = 1; } for (auto &e : adj[node]) { if (!res[e]) qu.push(e); } } 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:19:27: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   19 |         if (adj[i].size() < deg) {
      |             ~~~~~~~~~~~~~~^~~~~
#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...