Submission #772797

#TimeUsernameProblemLanguageResultExecution timeMemory
772797Abrar_Al_SamitSplit the Attractions (IOI19_split)C++17
11 / 100
77 ms12748 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; const int nax = 1e5 + 3; //subtask 2 vector<int>g[nax]; int m; bool vis[nax]; int a, b, c; vector<int> find_split(int n, int A, int B, int C, vector<int> p, vector<int> q) { a = A, b = B, c = C; m = p.size(); for(int i=0; i<m; ++i) { g[p[i]].push_back(q[i]); g[q[i]].push_back(p[i]); } vector<int>stk; queue<int>qu; qu.push(0); while(stk.size()<b) { int v = qu.front(); qu.pop(); if(vis[v]) continue; vis[v] = 1; stk.push_back(v); for(int u : g[v]) if(!vis[u]) { qu.push(u); } } int cnt = 0; vector<int>res(n, 0); for(int x : stk) { res[x] = 2; } for(int i=0; i<n; ++i) if(res[i]==0) { if(cnt<c) { ++cnt; res[i] = 3; } else { res[i] = 1; } } 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:29:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |  while(stk.size()<b) {
      |        ~~~~~~~~~~^~
#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...