Submission #1165245

#TimeUsernameProblemLanguageResultExecution timeMemory
1165245mychecksedadSuper Dango Maker (JOI22_dango3)C++20
0 / 100
853 ms724 KiB
#include "dango3.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>

namespace {

int variable_example = 1;

}  // namespace

void Solve(int n, int m) {
  vector<int> v;
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < m; ++j) v.pb(i*m + j + 1);
  }
  int cur = m-1;
  vector<vi> ans(m);
  while(v.size()){
    vector<int> V(all(v));
    int idx = V.back();
    V.pop_back();
    v.pop_back();
    int x = Query(V);
    int cc = cur;
    cur = x;
    int pos = m-1;
    int L=x, R=m-2;
    if(x == cc and cc+1 < m){
    while(L <= R){
      int mid = L+R>>1;
      for(int j=cur; j<=mid; ++j){
        for(int y: ans[j]) V.pb(y);
      }
      if(Query(V) == mid+1){
        L=mid+1;
      }else{
        pos=mid, R=mid-1;
      }
      for(int j=cur; j<=mid; ++j){
        for(int y: ans[j]) V.pop_back();
      }
    }
    }
    ans[pos].pb(idx);
  } 
  for(auto v: ans) Answer(v);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...