Submission #1170984

#TimeUsernameProblemLanguageResultExecution timeMemory
1170984bbartekMeetings (JOI19_meetings)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "meetings.h" using namespace std; typedef long long ll; #define st first #define nd second #define pb push_back const int maxn = 303; bool polaczone[maxn]; vector<int> synowie[maxn]; vector<int> kolejnosc; vector<pair<int,int>> wyniki; /* bool porownaj(int a,int b){ return synowie[a].size() < synowie[b].size(); } void Bridge(int a,int b){ cout<<a<<" "<<b<<"\n"; } vector<int> graf[maxn]; vector<int> odl(maxn); void dfs(int v,int p){ odl[v] = odl[p]+1; for(auto i : graf[v]){ if(i==p) continue; dfs(i,v); } } int Query(int a,int b,int c){ graf[0] = {2}; graf[1] = {2}; graf[2] = {0,1}; int minimum = 1e9,ind; for(int i=0;i<5;i++){ odl.clear(); dfs(i,8); if(odl[a]+odl[b]+odl[c] < minimum){ minimum = odl[a]+odl[b]+odl[c]; ind = i; } } return ind; } */ void Solve(int n){ //Query(a,b,c)//Bridge(a,b)// int x; for(int i=1;i<n;i++){ for(int j=i+1;j<n;j++){ x = Query(0,i,j); if(x == i){ synowie[i].pb(j); //cout<<i<<" "<<j<<"\n"; } else if(x == j){ synowie[j].pb(i); //cout<<j<<" "<<i<<"\n"; } } kolejnosc.pb(i); } sort(kolejnosc.begin(),kolejnosc.end(),porownaj); for(auto i : kolejnosc){ //cout<<i<<" "; for(auto j : synowie[i]){ if(polaczone[j]) continue; wyniki.pb({min(i,j),max(i,j)}); polaczone[j] = 1; } } for(int i=1;i<n;i++){ if(!polaczone[i]){ wyniki.pb({0,i}); } } for(auto i : wyniki){ Bridge(i.st,i.nd); } return; } /* int main(){ Solve(3); return 0; } */

Compilation message (stderr)

meetings.cpp: In function 'void Solve(int)':
meetings.cpp:59:17: error: 'Query' was not declared in this scope
   59 |             x = Query(0,i,j);
      |                 ^~~~~
meetings.cpp:72:44: error: 'porownaj' was not declared in this scope
   72 |     sort(kolejnosc.begin(),kolejnosc.end(),porownaj);
      |                                            ^~~~~~~~
meetings.cpp:91:9: error: 'Bridge' was not declared in this scope
   91 |         Bridge(i.st,i.nd);
      |         ^~~~~~