Submission #195580

#TimeUsernameProblemLanguageResultExecution timeMemory
195580theStaticMindMeetings (JOI19_meetings)C++14
29 / 100
2013 ms1876 KiB
#include "meetings.h" #include<bits/stdc++.h> #define pb push_back #define ii pair<int,int> #define all(x) (x).begin(),(x).end() using namespace std; void dp(vector<int>& data,int curr){ if(data.empty())return; for(int i=0;i<data.size();i++)swap(data[rand()%(1*data.size())],data[rand()%(1*data.size())]); int big=data[0]; vector<int>sub,other; unordered_set<int> vis; sub.pb(big); vis.insert(big); for(int i=1;i<data.size();i++){ if(data[i]==big){ if(!vis.count(big)){ vis.insert(big); sub.pb(big); } continue; } int q=Query(big,curr,data[i]); if(q==curr)other.pb(data[i]); else{ sub.pb(data[i]); vis.insert(data[i]); big=q; } } Bridge(min(curr,big),max(curr,big)); sub.erase(find(all(sub),big)); dp(sub,big); dp(other,curr); } void Solve(int N){ srand(time(NULL)); vector<int>arr; int x=rand()%N; for(int i=0;i<N;i++)arr.pb(i); arr.erase(arr.begin()+x); for(int i=0;i<1e5;i++)swap(arr[rand()%(N-1)],arr[rand()%(N-1)]); dp(arr,x); }

Compilation message (stderr)

meetings.cpp: In function 'void dp(std::vector<int>&, int)':
meetings.cpp:10:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i=0;i<data.size();i++)swap(data[rand()%(1*data.size())],data[rand()%(1*data.size())]);
                   ~^~~~~~~~~~~~
meetings.cpp:16:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i=1;i<data.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...