답안 #722052

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
722052 2023-04-11T11:06:29 Z MohammadAghil Super Dango Maker (JOI22_dango3) C++17
100 / 100
1230 ms 880 KB
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 340 KB Output is correct
2 Correct 12 ms 340 KB Output is correct
3 Correct 14 ms 340 KB Output is correct
4 Correct 14 ms 368 KB Output is correct
5 Correct 12 ms 380 KB Output is correct
6 Correct 12 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 294 ms 612 KB Output is correct
2 Correct 294 ms 652 KB Output is correct
3 Correct 310 ms 492 KB Output is correct
4 Correct 316 ms 624 KB Output is correct
5 Correct 282 ms 520 KB Output is correct
6 Correct 279 ms 616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1109 ms 868 KB Output is correct
2 Correct 1114 ms 780 KB Output is correct
3 Correct 1220 ms 880 KB Output is correct
4 Correct 1230 ms 776 KB Output is correct
5 Correct 1075 ms 880 KB Output is correct
6 Correct 1077 ms 724 KB Output is correct