Submission #713530

#TimeUsernameProblemLanguageResultExecution timeMemory
713530PherokungMeetings (JOI19_meetings)C++14
29 / 100
1846 ms1792 KiB
#include "meetings.h" #include<bits/stdc++.h> using namespace std; int n,temp; bool func(int a,int b) { return Query(temp,a,b) == a; } void Ans(int a,int b){ if(a > b) swap(a,b); Bridge(a,b); } void sol(vector<int> v){ if(v.size() < 2) return; //random_shuffle(v.begin(),v.end()); int a = v[0], b = v[1]; map<int,vector<int> > mp; mp[a].push_back(a), mp[b].push_back(b); vector<int> adj; for(int i=2;i<v.size();i++){ int c = Query(a,b,v[i]); if(!mp.count(c) ) adj.push_back(c); mp[c].push_back(v[i]); } temp = a; sort(adj.begin(), adj.end(), func); int now = a; for(auto x : adj) Ans(now,x), now = x; Ans(now,b); for(auto it : mp) sol(it.second); } void Solve(int N) { n = N; vector<int> v(n); iota(v.begin(),v.end(),0); sol(v); }

Compilation message (stderr)

meetings.cpp: In function 'void sol(std::vector<int>)':
meetings.cpp:22:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   for(int i=2;i<v.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...