Submission #945250

# Submission time Handle Problem Language Result Execution time Memory
945250 2024-03-13T15:08:44 Z socpite Super Dango Maker (JOI22_dango3) C++17
100 / 100
380 ms 964 KB
#include<bits/stdc++.h>
using namespace std;

int Query(const std::vector<int> &x);

void Answer(const std::vector<int> &a);

void dnc_solve(int N, int M, const vector<int> &a){
    if(M == 1){
        Answer(a);
        return;
    }
    vector<int> v1, v2;
    for(int i = 0; i < a.size(); i++){
        vector<int> nw = v1;
        for(int j = i + 1; j < a.size(); j++)nw.push_back(a[j]);
        if(Query(nw) < M/2)v1.push_back(a[i]);
        else v2.push_back(a[i]);
    }
    dnc_solve(N, M/2, v1);
    dnc_solve(N, (M+1)/2, v2);
}

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

Compilation message

dango3.cpp: In function 'void dnc_solve(int, int, const std::vector<int>&)':
dango3.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i = 0; i < a.size(); i++){
      |                    ~~^~~~~~~~~~
dango3.cpp:16:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(int j = i + 1; j < a.size(); j++)nw.push_back(a[j]);
      |                            ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 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 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 4 ms 532 KB Output is correct
3 Correct 4 ms 348 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 588 KB Output is correct
2 Correct 80 ms 872 KB Output is correct
3 Correct 108 ms 628 KB Output is correct
4 Correct 101 ms 964 KB Output is correct
5 Correct 79 ms 612 KB Output is correct
6 Correct 79 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 308 ms 736 KB Output is correct
2 Correct 342 ms 676 KB Output is correct
3 Correct 380 ms 916 KB Output is correct
4 Correct 377 ms 732 KB Output is correct
5 Correct 323 ms 600 KB Output is correct
6 Correct 302 ms 664 KB Output is correct