Submission #942529

# Submission time Handle Problem Language Result Execution time Memory
942529 2024-03-10T19:47:03 Z makrav Super Dango Maker (JOI22_dango3) C++17
100 / 100
1159 ms 992 KB
#include "dango3.h"
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()

vector<int> sol(int n, int m, vector<int> nums) {
    random_shuffle(all(nums));
    vector<int> used(n * m, 0), ans;
    for (int i = 0; i < n * m; i++) {
        if (ans.size() == n) return ans;
        vector<int> lol;
        used[i] = 1;
        for (int j = 0; j < n * m; j++) {
            if (!used[j]) lol.push_back(nums[j]);
        }
        int A = Query(lol);
        if (A != m - 1) {
            used[i] = 0;
            continue;
        }
        ans.push_back(nums[i]);
    }
    return ans;
}

void Solve(int N, int M) {
    vector<int> used(N * M, 0);
    for (int j = 0; j < M; j++) {
        vector<int> curost;
        for (int i = 0; i < N * M; i++) {
            if (!used[i]) curost.push_back(i + 1);
        }
        vector<int> answ = sol(N, M - j, curost);
        Answer(answ);
        for (int j = 0; j < answ.size(); j++) used[answ[j] - 1] = 1;
    }
}

Compilation message

dango3.cpp: In function 'std::vector<int> sol(int, int, std::vector<int>)':
dango3.cpp:12:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |         if (ans.size() == n) return ans;
      |             ~~~~~~~~~~~^~~~
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:37:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         for (int j = 0; j < answ.size(); j++) used[answ[j] - 1] = 1;
      |                         ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 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 8 ms 348 KB Output is correct
2 Correct 6 ms 348 KB Output is correct
3 Correct 5 ms 600 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 6 ms 348 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 155 ms 604 KB Output is correct
2 Correct 161 ms 848 KB Output is correct
3 Correct 210 ms 604 KB Output is correct
4 Correct 155 ms 656 KB Output is correct
5 Correct 160 ms 672 KB Output is correct
6 Correct 152 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 751 ms 824 KB Output is correct
2 Correct 1159 ms 788 KB Output is correct
3 Correct 714 ms 824 KB Output is correct
4 Correct 898 ms 772 KB Output is correct
5 Correct 693 ms 992 KB Output is correct
6 Correct 698 ms 816 KB Output is correct