Submission #879842

#TimeUsernameProblemLanguageResultExecution timeMemory
879842LibSplit the Attractions (IOI19_split)C++14
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "split.h" using namespace std; vector <vector <int> > adj; vector <int> TVector; int cpos[200003]; deque <int> clist; vector <int> find_split(int n, int a, int b, int c, vector <int> p, vector <int> q){ vector <int> ans; vector <int> Group1,Group2; int SmallestGroupID,MiddleGroupID; //Only cares about the 2 smaller group: Assuming that we DID find a solution where the largest group is connected, just swap some of those points for the unused group. //As this is the largest group, swapping some minor connected parts for the unused group is still valid, and always doable => only care about 2 smallest group only //very intuitive tbh vector <pair <int,int> > order; order.push_back({a,1}); order.push_back({b,2}); order.push_back({c,3}); sort(order.begin(),order.end()); SmallestGroupID=order[0].second; MiddleGroupID=order[1].second; for(int i=0;i<=n+1;i++){ adj.push_back(TVector); } for(int i=0;i<n;i++){ ans.push_back(0); } for(int i=0;i<p.size();i++){ adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } return ans; }

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:28:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for(int i=0;i<p.size();i++){
      |              ~^~~~~~~~~
split.cpp:11:6: warning: variable 'SmallestGroupID' set but not used [-Wunused-but-set-variable]
   11 |  int SmallestGroupID,MiddleGroupID;
      |      ^~~~~~~~~~~~~~~
split.cpp:11:22: warning: variable 'MiddleGroupID' set but not used [-Wunused-but-set-variable]
   11 |  int SmallestGroupID,MiddleGroupID;
      |                      ^~~~~~~~~~~~~
#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...