Submission #938678

#TimeUsernameProblemLanguageResultExecution timeMemory
938678groshiMeetings (JOI19_meetings)C++17
100 / 100
647 ms2900 KiB
#include"meetings.h" #include<bits/stdc++.h> using namespace std; int N; /*int Query(int x,int y,int z) { cout<<x<<" "<<y<<" "<<z<<": "; int wynik; cin>>wynik; cout<<"\n"; return wynik; } void Bridge(int x,int y) { cout<<x<<" "<<y<<" buduje\n"; }*/ void dfs(int x,vector<int> Q) { if(Q.size()==0) return; int strzal=rand()%(Q.size()); strzal=Q[strzal]; //cout<<x<<" "<<strzal<<"\n"; vector<int> sasiad[N],sciezka; for(int i=0;i<Q.size();i++) { if(Q[i]==strzal) continue; int mam=Query(x,strzal,Q[i]); if(mam==Q[i]) sciezka.push_back(Q[i]); else{ //cout<<"wrzucam "<<mam<<" "<<Q[i]<<"\n"; sasiad[mam].push_back(Q[i]); } } sort(sciezka.begin(),sciezka.end(),[&](int a,int b){return Query(x,a,b)==a;}); sciezka.push_back(strzal); int pocz=x; for(int i=0;i<sciezka.size();i++) { Bridge(min(pocz,sciezka[i]),max(pocz,sciezka[i])); pocz=sciezka[i]; } sciezka.push_back(x); for(int i=0;i<sciezka.size();i++) dfs(sciezka[i],sasiad[sciezka[i]]); } void Solve(int n) { N=n; int korzen=rand()%n; vector<int> wszyscy; for(int i=0;i<n;i++) if(i!=korzen) wszyscy.push_back(i); dfs(korzen,wszyscy); }

Compilation message (stderr)

meetings.cpp: In function 'void dfs(int, std::vector<int>)':
meetings.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i=0;i<Q.size();i++)
      |                 ~^~~~~~~~~
meetings.cpp:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for(int i=0;i<sciezka.size();i++)
      |                 ~^~~~~~~~~~~~~~~
meetings.cpp:46:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for(int i=0;i<sciezka.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...