#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 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){
vector<int>v(n*m);
for(int i = 1;i<=n*m;i++){
v.pb(i);
}
queue<pair<vector<int>,int>>q;
q.push({v,m});
while(!q.empty()){
auto [g,sz] = q.front();
q.pop();
if(sz==1){
Answer(g);
continue;
}
int pl = g.size();
vector<int>vs;
for(int i = 0;i<pl;i++){
vs.pb(g[0]);
g.erase(g.begin());
int x = Query(g);
if(x<sz/2){
g.pb(vs.back());
vs.pop_back();
}
}
q.push({g,sz/2});
q.push({vs,(sz+1)/2});
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |