Submission #554682

#TimeUsernameProblemLanguageResultExecution timeMemory
554682ArvinSuper Dango Maker (JOI22_dango3)C++17
22 / 100
840 ms273964 KiB
#include "dango3.h" #include <bits/stdc++.h> using namespace std; //namespace { // int variable_example = 1; //} // namespace map<vector<int>, int> mp; void Solve(int n, int m) { int len = n*m; vector<int> v; for(int x=0;x<len;x++){ v.push_back(x+1); } auto ask = [&](vector<int> &v) -> int { if(mp.count(v)) return mp[v]; return mp[v] = Query(v); }; int cnt = m; while(cnt > 0){ vector<int> w = v; vector<int> ans; int pos = 0; while(pos < w.size() && ans.size()+1 < n){ int bound = 0; int left = pos, right = w.size()-1; while(left <= right){ int mid = (left+right) >> 1; vector<int> z = ans; for(int x=mid;x<w.size();x++){ z.push_back(w[x]); } if(ask(z) > 0){ bound = mid; left = mid+1; } else { right = mid-1; } } ans.push_back(w[bound]); pos = bound+1; } ans.push_back(w.back()); v.clear(); pos = 0; for(int x=0;x<w.size();x++){ while(pos < ans.size() && ans[pos] < w[x]){ pos++; } if(pos < ans.size() && ans[pos] == w[x]) continue; v.push_back(w[x]); } Answer(ans); cnt--; } }

Compilation message (stderr)

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:30:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   while(pos < w.size() && ans.size()+1 < n){
      |         ~~~~^~~~~~~~~~
dango3.cpp:30:40: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |   while(pos < w.size() && ans.size()+1 < n){
      |                           ~~~~~~~~~~~~~^~~
dango3.cpp:37:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int x=mid;x<w.size();x++){
      |                   ~^~~~~~~~~
dango3.cpp:56:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |   for(int x=0;x<w.size();x++){
      |               ~^~~~~~~~~
dango3.cpp:57:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |    while(pos < ans.size() && ans[pos] < w[x]){
      |          ~~~~^~~~~~~~~~~~
dango3.cpp:60:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |    if(pos < ans.size() && ans[pos] == w[x]) continue;
      |       ~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...