답안 #1066370

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1066370 2024-08-19T19:21:20 Z sammyuri Super Dango Maker (JOI22_dango3) C++17
22 / 100
217 ms 688 KB
#include "dango3.h"

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

void Solve(int N, int M) {
    mt19937 rng(1000);
    vector<int> mapping(N * M);
    for (int i = 0; i < N * M; i ++)
        mapping[i] = i + 1;
    shuffle(mapping.begin(), mapping.end(), rng);
    vector<int> active;
    for (int i = 0; i < N * M; i ++) {
        active.push_back(mapping[i]);
        int xx = Query(active);
        if (xx == 0)
            continue;
        // remove pointless ones
        vector<int> cur = active;
        vector<int> secure;
        vector<int> wasted;
        int ii = 0;
        while (cur.size() - ii + secure.size() > N) {
            vector<int> test = secure;
            for (int j = ii + 1; j < active.size(); j ++)
                test.push_back(active[j]);
            int ans = Query(test);
            if (ans == 0)
                secure.push_back(active[ii]);
            else
                wasted.push_back(active[ii]);
            ii ++;
        }
        for (int j = ii; j < active.size(); j ++)
            secure.push_back(active[j]);
        Answer(secure);
        active = wasted;
    }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:23:48: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |         while (cur.size() - ii + secure.size() > N) {
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
dango3.cpp:25:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             for (int j = ii + 1; j < active.size(); j ++)
      |                                  ~~^~~~~~~~~~~~~~~
dango3.cpp:34:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for (int j = ii; j < active.size(); j ++)
      |                          ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 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
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 556 KB Output is correct
2 Correct 61 ms 556 KB Output is correct
3 Correct 54 ms 600 KB Output is correct
4 Correct 52 ms 604 KB Output is correct
5 Correct 59 ms 600 KB Output is correct
6 Correct 61 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 217 ms 688 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -