Submission #783097

# Submission time Handle Problem Language Result Execution time Memory
783097 2023-07-14T15:24:04 Z JooDdae Super Dango Maker (JOI22_dango3) C++17
7 / 100
396 ms 688 KB
#include "dango3.h"

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int m;

vector<int> done, imsi;
vector<int> type[404];

int query(vector<int> q) {
    for(auto x : done) q.push_back(x);
    for(auto x : imsi) q.push_back(x);
    return Query(q);
}

void find(int u, vector<int> v) {
    int s = v.size();
    if(s == 1) {
        // cout << "add " << v[0] << "\n";
        type[u].push_back(v[0]);
        return;
    }

    vector<int> v1 = vector<int>(v.begin(), v.begin()+s/2), v2 = vector<int>(v.begin()+s/2, v.end());

    if(query(v1)) find(u, v1);
    if(query(v2)) find(u, v2);
}

void Solve(int N, int M) {
    m = M;

    vector<int> v(N*M);
    iota(v.begin(), v.end(), 1);

    random_device rd;
    shuffle(v.begin(), v.end(), mt19937(rd()));

    for(int i=0;i<N-1;i++) {
        // cout << i << " " << v.size() << endl;

        int l = 1, r = (int)v.size()-1;
        while(l <= r) {
            int mid = (l+r) >> 1;

            auto re = query(vector<int>(v.begin(), v.begin()+mid+1));
            if(re) r = mid-1;
            else l = mid+1;
        }

        imsi = vector<int>(v.begin(), v.begin()+l);

        find(i, vector<int>(v.begin()+l, v.end()));

        for(auto x : type[i]) done.push_back(x);
        for(auto x : type[i]) v.erase(find(v.begin(), v.end(), x));
        imsi.clear();

        // for(auto x : v) cout << x << " ";
        // cout << "DONE------------" << endl;
    }

    type[N-1] = v;

    for(int i=0;i<M;i++) {
        vector<int> re;
        for(int j=0;j<N;j++) {
            re.push_back(type[j][i]);
        }
        Answer(re);
    }
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 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 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 540 KB Output is correct
2 Correct 22 ms 476 KB Output is correct
3 Correct 23 ms 516 KB Output is correct
4 Correct 27 ms 468 KB Output is correct
5 Correct 21 ms 488 KB Output is correct
6 Correct 23 ms 528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 335 ms 632 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 396 ms 688 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -