이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "dango3.h"
using namespace std;
#define rep(i,l,r) for(int i = (l); i < (r); i++)
#define per(i,r,l) for(int i = (r); i >= (l); i--)
#define all(x) begin(x), end(x)
#define sz(x) (int)size(x)
#define pb push_back
#define ff first
#define ss second
typedef long long ll;
typedef pair<int, int> pp;
void dbg(){
cerr << endl;
}
template<typename H, typename... T> void dbg(H h, T... t){
cerr << h << ", ";
dbg(t...);
}
void IOS(){
cin.tie(0) -> sync_with_stdio(0);
#ifndef ONLINE_JUDGE
// freopen("inp.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#define er(...) cerr << __LINE__ << " <" << #__VA_ARGS__ << ">: ", dbg(__VA_ARGS__)
#else
#define er(...) 0
#endif
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod = 998244353, maxn = 2e5 + 5, lng = 20, inf = ll(1e9) + 5;
ll pw(ll a, ll b){
if(b == 1) return a;
ll k = pw(a, b>>1);
return k*k%mod*(b&1ll?a:1ll)%mod;
}
int n;
void slv(vector<int> a){
int m = sz(a)/n;
if(m == 1){
Answer(a);
return;
}
int mid = m>>1;
vector<bool> del(sz(a));
vector<int> ret[2];
rep(i,0,sz(a)){
del[i] = true;
vector<int> tmp;
rep(j,0,sz(a)){
if(!del[j]){
tmp.pb(a[j]);
}
}
if(Query(tmp) < mid){
del[i] = false;
}
ret[del[i]].pb(a[i]);
}
slv(ret[0]);
slv(ret[1]);
}
void Solve(int n, int m){
::n = n;
vector<int> a(n*m);
iota(all(a), 1);
slv(a);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |