Submission #783086

# Submission time Handle Problem Language Result Execution time Memory
783086 2023-07-14T15:10:41 Z JooDdae Super Dango Maker (JOI22_dango3) C++17
7 / 100
169 ms 540 KB
#include "dango3.h"

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

vector<int> done;

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

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

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

    vector<vector<int>> type(N, vector<int>());

    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));
            // cout << mid << " " << re << endl;
            if(re) r = mid-1;
            else l = mid+1;
        }
        // cout << l << " " << r << "]" << endl;

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

        for(int u=l;u<v.size();u++) {
            x.push_back(v[u]);
            if(query(x)) {
                type[i].push_back(v[u]);
                // cout << v[u] << " ";
                v.erase(v.begin()+u), u--;
            }
            x.pop_back();
        }

        for(auto x : type[i]) done.push_back(x);
        // cout << "DONE------------\n";
    }

    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);
    }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:39:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for(int u=l;u<v.size();u++) {
      |                     ~^~~~~~~~~
# Verdict Execution time Memory 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 304 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 428 KB Output is correct
2 Correct 55 ms 380 KB Output is correct
3 Correct 56 ms 424 KB Output is correct
4 Correct 65 ms 540 KB Output is correct
5 Correct 63 ms 420 KB Output is correct
6 Correct 56 ms 408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 90 ms 432 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 169 ms 516 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -