Submission #544815

# Submission time Handle Problem Language Result Execution time Memory
544815 2022-04-02T18:45:39 Z Ronin13 Super Dango Maker (JOI22_dango3) C++17
100 / 100
4077 ms 800 KB
#include "dango3.h"
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define ull unsigned ll
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
using namespace std;


void Solve(int N, int M) {
    int n = N;
    int m = M;
    vector <vector<int> > dango(m + 1);
    vector <bool> used(n * m + 1, false);
    for(int i = 1; i <= n * m; i++){
        int l = 0, r = m;
        used[i] = true;
        while(l + 1 < r){
            int mid = (l + r) / 2;
            for(int to : dango[mid]) used[to] = true;
            vector <int> vec;
            for(int j = 1; j <= n * m; j++){
                if(!used[j]) vec.pb(j);
            }
            for(int to : dango[mid]) used[to] = false;
            int x = Query(vec);
            if(x <= m - 2)l = mid;
            else r = mid;
        }
        used[i] = false;
        dango[r].pb(i);
    }
    for(int i = 1; i <= m; i++){
        Answer(dango[i]);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 340 KB Output is correct
2 Correct 29 ms 340 KB Output is correct
3 Correct 33 ms 340 KB Output is correct
4 Correct 33 ms 364 KB Output is correct
5 Correct 29 ms 368 KB Output is correct
6 Correct 35 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1030 ms 436 KB Output is correct
2 Correct 1018 ms 680 KB Output is correct
3 Correct 1006 ms 540 KB Output is correct
4 Correct 961 ms 604 KB Output is correct
5 Correct 1004 ms 672 KB Output is correct
6 Correct 1008 ms 668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4077 ms 800 KB Output is correct
2 Correct 3982 ms 792 KB Output is correct
3 Correct 3874 ms 776 KB Output is correct
4 Correct 3897 ms 572 KB Output is correct
5 Correct 3897 ms 656 KB Output is correct
6 Correct 3847 ms 772 KB Output is correct