Submission #601857

#TimeUsernameProblemLanguageResultExecution timeMemory
601857Minindu2006Split the Attractions (IOI19_split)C++14
0 / 100
542 ms1048576 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; const int MX = 1e5 + 5; vector<int> adj[MX], vis(MX, 0); void dfs(int i, vector<int> &tre) { vis[i] = 1; tre.push_back(i); for(auto a:adj[i]) { if(!vis[a]) dfs(i, tre); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> res(n, 3); int m = p.size(); for(int i=0;i<m;i++) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } int st = -1, numC = INT_MAX; for(int i=0;i<n;i++) { if(numC > (adj[i].size())) numC = (adj[i].size()), st = i; } vector<int> path; dfs(st, path); for(int i=0;i<a;i++) res[path[i]] = 1; for(int i=a;i<a+b;i++) res[path[i]] = 2; 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:30:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   if(numC > (adj[i].size()))
      |      ~~~~~^~~~~~~~~~~~~~~~~
#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...