제출 #1165252

#제출 시각아이디문제언어결과실행 시간메모리
1165252mychecksedadSuper Dango Maker (JOI22_dango3)C++20
100 / 100
741 ms756 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 cc = cur; int pos = max(0, cc-1); int L=pos+1, R=m-1; 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){ L=mid+1; pos= mid; }else{ R=mid-1; } for(int j=cur; j<mid; ++j){ for(int y: ans[j]) V.pop_back(); } } ans[pos].pb(idx); cur=min(cur, pos); } 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...