Submission #568768

# Submission time Handle Problem Language Result Execution time Memory
568768 2022-05-26T07:43:35 Z tqbfjotld Super Dango Maker (JOI22_dango3) C++17
100 / 100
4062 ms 516 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;

namespace {

int n,m;
int in[10005];

void func(int id){
    int l = 0;
    int r = m;
    while (l+1<r){
        int mid = (l+r)/2;
        vector<int> q;
        for (int x = 1; x<=n*m; x++){
            if (x==id) continue;
            if (in[x]>=l && in[x]<mid){
                continue;
            }
            q.push_back(x);
        }
        int res = Query(q);
        if (res>=m-(mid-l)){
            r = mid;
        }
        else{
            l = mid;
        }
    }
    in[id] = l;

}

}  // namespace

void Solve(int N, int M) {
    n = N;
    m = M;
    memset(in,-1,sizeof(in));
    for (int x = 1; x<=n*m; x++){
        func(x);
    }
    for (int x = 0; x<m; x++){
        vector<int> ans;
        for (int y = 1; y<=n*m; y++){
            if (in[y]==x){
                ans.push_back(y);
            }
        }
        Answer(ans);
    }
}

# 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 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 340 KB Output is correct
2 Correct 30 ms 400 KB Output is correct
3 Correct 28 ms 412 KB Output is correct
4 Correct 31 ms 380 KB Output is correct
5 Correct 23 ms 396 KB Output is correct
6 Correct 32 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1055 ms 468 KB Output is correct
2 Correct 1038 ms 468 KB Output is correct
3 Correct 1044 ms 448 KB Output is correct
4 Correct 988 ms 444 KB Output is correct
5 Correct 1000 ms 468 KB Output is correct
6 Correct 962 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3918 ms 512 KB Output is correct
2 Correct 4006 ms 516 KB Output is correct
3 Correct 4062 ms 512 KB Output is correct
4 Correct 3918 ms 512 KB Output is correct
5 Correct 3554 ms 516 KB Output is correct
6 Correct 3503 ms 516 KB Output is correct