Submission #711854

# Submission time Handle Problem Language Result Execution time Memory
711854 2023-03-17T15:19:50 Z kostia244 Super Dango Maker (JOI22_dango3) C++17
100 / 100
745 ms 672 KB
#include "dango3.h"

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

namespace {

int variable_example = 1;
void solve(vector<int> a, int cnt) {
    if(cnt == 1) {
        Answer(a);
        return;
    }
    int m = cnt / 2;
    vector<int> b;
    for(int i = a.size(); i--;) {
        swap(a[i], a.back());
        int t = a.back();
        a.pop_back();
        if(Query(a) < m)
            a.push_back(t);
        else
            b.push_back(t);
    }
    solve(a, m);
    solve(b, cnt - m);
}
}  // namespace

void Solve(int N, int M) {
    vector<int> a;
    for(int i = 0; i < N * M; i++)
        a.push_back(1 + i);
    solve(a, M);
}

Compilation message

dango3.cpp:8:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    8 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# 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 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 304 KB Output is correct
2 Correct 8 ms 340 KB Output is correct
3 Correct 8 ms 376 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 7 ms 340 KB Output is correct
6 Correct 7 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 165 ms 468 KB Output is correct
2 Correct 166 ms 468 KB Output is correct
3 Correct 181 ms 468 KB Output is correct
4 Correct 116 ms 440 KB Output is correct
5 Correct 147 ms 472 KB Output is correct
6 Correct 153 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 620 ms 672 KB Output is correct
2 Correct 584 ms 652 KB Output is correct
3 Correct 731 ms 592 KB Output is correct
4 Correct 745 ms 652 KB Output is correct
5 Correct 622 ms 588 KB Output is correct
6 Correct 600 ms 672 KB Output is correct