답안 #1033117

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1033117 2024-07-24T13:02:33 Z shenfe1 Super Dango Maker (JOI22_dango3) C++17
100 / 100
2308 ms 1844 KB
#include "dango3.h"
#include <bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(s) (int)s.size()
#define ppb pop_back
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,m;

vector<int> xo(vector<vector<int>> a,int mid){
    vector<int> use(n*m+1,0);
    for(int i=0;i<=mid;i++){
        for(int j=0;j<sz(a[i]);j++){
            use[a[i][j]]=1;
        }
    }
    vector<int> vec;
    for(int i=1;i<=n*m;i++)if(!use[i])vec.pb(i);
    return vec;
}

void Solve(int N, int M) {
    n=N,m=M;
    vector<vector<int>> a(M);
    for(int i=1;i<=N*M;i++){
        int l=0,r=M-1,res=M-1;
        while(l<=r){
            int m=(l+r)/2;
            a[m].pb(i);
            if(M-Query(xo(a,m))==m+2){
                l=m+1;
            }
            else{
                r=m-1;
                res=m;
            }
            a[m].ppb();
        }
        // cout<<i<<" "<<res<<'\n';
        a[res].pb(i);
    }
    for(int i=0;i<M;i++)Answer(a[i]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 856 KB Output is correct
2 Correct 11 ms 520 KB Output is correct
3 Correct 12 ms 516 KB Output is correct
4 Correct 12 ms 348 KB Output is correct
5 Correct 10 ms 348 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 343 ms 600 KB Output is correct
2 Correct 342 ms 604 KB Output is correct
3 Correct 500 ms 596 KB Output is correct
4 Correct 476 ms 876 KB Output is correct
5 Correct 352 ms 620 KB Output is correct
6 Correct 333 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1559 ms 732 KB Output is correct
2 Correct 1638 ms 920 KB Output is correct
3 Correct 2195 ms 1080 KB Output is correct
4 Correct 2308 ms 1844 KB Output is correct
5 Correct 1785 ms 760 KB Output is correct
6 Correct 1703 ms 940 KB Output is correct