# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
892537 | Minbaev | Super Dango Maker (JOI22_dango3) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "dango3.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast,unroll-loops")
#define pii pair<int,int>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define int long long
#define f first
#define s second
#define pii pair<int,int>
template<class T>bool umax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>bool umin(T &a,T b){if(b<a){a=b;return true;}return false;}
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
const int mod= 1e9 +7;
const int N=1e5*4;
void Solve(int n,int m){
int cnt = m;
while(cnt>0){
int l = 1,r = n*m,ans = 0;
vector<int>vis(n*m+1);
while(l<=r){
int mid = (l+r) >> 1;
vector<int>vs;
for(int i = 1;i<=mid;i++){
if(!vis[i])
vs.pb(i);
}
vector<int>ans1(vs.size());
for(auto &to:vs)ans1.pb(to);
int x = Query(ans1);
if(x>1){
r = mid - 1;
}
else if(x==1){
ans = mid;
break;
}
else l = mid + 1;
}
vector<int>vs;
for(int i = 1;i<=ans;i++){
if(!vis[i])
vs.pb(i);
vis[i] = 1;
}
vector<int>ans(vs.size());
for(auto &to:vs)ans.pb(to);
Answer(to);
}
}