Submission #938677

#TimeUsernameProblemLanguageResultExecution timeMemory
938677groshiMeetings (JOI19_meetings)C++17
Compilation error
0 ms0 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:17:16: error: 'vector' has not been declared
   17 | void dfs(int x,vector<int> Q)
      |                ^~~~~~
meetings.cpp:17:22: error: expected ',' or '...' before '<' token
   17 | void dfs(int x,vector<int> Q)
      |                      ^
meetings.cpp: In function 'void dfs(int, int)':
meetings.cpp:19:8: error: 'Q' was not declared in this scope
   19 |     if(Q.size()==0)
      |        ^
meetings.cpp:21:16: error: 'rand' was not declared in this scope
   21 |     int strzal=rand()%(Q.size());
      |                ^~~~
meetings.cpp:21:24: error: 'Q' was not declared in this scope
   21 |     int strzal=rand()%(Q.size());
      |                        ^
meetings.cpp:24:5: error: 'vector' was not declared in this scope
   24 |     vector<int> sasiad[N],sciezka;
      |     ^~~~~~
meetings.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include"meetings.h"
  +++ |+#include <vector>
    2 | //#include<bits/stdc++.h>
meetings.cpp:24:12: error: expected primary-expression before 'int'
   24 |     vector<int> sasiad[N],sciezka;
      |            ^~~
meetings.cpp:31:13: error: 'sciezka' was not declared in this scope
   31 |             sciezka.push_back(Q[i]);
      |             ^~~~~~~
meetings.cpp:34:13: error: 'sasiad' was not declared in this scope
   34 |             sasiad[mam].push_back(Q[i]);
      |             ^~~~~~
meetings.cpp:37:10: error: 'sciezka' was not declared in this scope
   37 |     sort(sciezka.begin(),sciezka.end(),[&](int a,int b){return Query(x,a,b)==a;});
      |          ^~~~~~~
meetings.cpp:37:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   37 |     sort(sciezka.begin(),sciezka.end(),[&](int a,int b){return Query(x,a,b)==a;});
      |     ^~~~
      |     short
meetings.cpp:42:16: error: 'min' was not declared in this scope
   42 |         Bridge(min(pocz,sciezka[i]),max(pocz,sciezka[i]));
      |                ^~~
meetings.cpp:42:37: error: 'max' was not declared in this scope
   42 |         Bridge(min(pocz,sciezka[i]),max(pocz,sciezka[i]));
      |                                     ^~~
meetings.cpp:47:24: error: 'sasiad' was not declared in this scope
   47 |         dfs(sciezka[i],sasiad[sciezka[i]]);
      |                        ^~~~~~
meetings.cpp: In function 'void Solve(int)':
meetings.cpp:52:16: error: 'rand' was not declared in this scope
   52 |     int korzen=rand()%n;
      |                ^~~~
meetings.cpp:53:5: error: 'vector' was not declared in this scope
   53 |     vector<int> wszyscy;
      |     ^~~~~~
meetings.cpp:53:5: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
meetings.cpp:53:12: error: expected primary-expression before 'int'
   53 |     vector<int> wszyscy;
      |            ^~~
meetings.cpp:56:13: error: 'wszyscy' was not declared in this scope
   56 |             wszyscy.push_back(i);
      |             ^~~~~~~
meetings.cpp:57:16: error: 'wszyscy' was not declared in this scope
   57 |     dfs(korzen,wszyscy);
      |                ^~~~~~~