Submission #869637

#TimeUsernameProblemLanguageResultExecution timeMemory
869637willychanSuper Dango Maker (JOI22_dango3)C++17
7 / 100
1206 ms956 KiB
#include "dango3.h" #include <vector> #include<random> #include<algorithm> #include<iostream> #include<cassert> using namespace std; namespace { int variable_example = 1; int n,m; } // namespace void process(vector<int> &get,vector<int> &pos){ int k = pos.size(); random_shuffle(pos.begin(),pos.end()); vector<int> a; for(int i=1;i<k;i++) a.push_back(pos[i]); vector<bool> notin(k,0); notin[0]=1; int should = (k/n)-1; for(int i=1;i<k;i++){ notin[i]=1; vector<int> q; for(int i=0;i<k;i++) if(!notin[i]) q.push_back(pos[i]); int g = Query(q); if(g!=should) notin[i]=0; } for(int i=0;i<k;i++) if(notin[i]) get.push_back(pos[i]); } void Solve(int N, int M) { n = N;m = M; vector<int> pos(N*M); vector<bool> in(N*M+1); for(int i=0;i<N*M;i++) pos[i] = i+1; for(int i=0;i<M-1;i++){ vector<int> get; process(get,pos); for(auto i : get) in[i]=1; assert(get.size()==n); Answer(get); vector<int> temp; for(auto i : pos) if(!in[i]) temp.push_back(i); swap(pos,temp); } Answer(pos); /*for(auto i : pos) ans.push_back(i); for(int i=0;i<M;i++){ vector<int> ret; for(int j=0;j<N;j++){ ret.push_back(ans[j*N+i]); } Answer(ret); }*/ }

Compilation message (stderr)

In file included from /usr/include/c++/10/cassert:44,
                 from dango3.cpp:7:
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:41:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |   assert(get.size()==n);
      |          ~~~~~~~~~~^~~
dango3.cpp: At global scope:
dango3.cpp:11:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   11 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...