답안 #1112046

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1112046 2024-11-13T14:56:56 Z onlk97 Super Dango Maker (JOI22_dango3) C++17
100 / 100
124 ms 780 KB
#include "dango3.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
const int THRES=2000;
namespace {

int variable_example = 1;

}  // namespace

void Solve(int N, int M){
    random_device rd;
    mt19937 mt(rd());
    vector <int> rem;
    for (int i=1; i<=N*M; i++) rem.push_back(i);
    for (int i=1; i<M; i++){
        br:;
        shuffle(rem.begin(),rem.end(),mt);
        vector <int> v;
        vector <int> orirem=rem;
        for (int j=0; j<THRES&&!rem.empty(); j++){
            v.push_back(rem.back());
            rem.pop_back();
        }
        if (!Query(v)){
            for (int j:v) rem.push_back(j);
            goto br;
        }
        while (v.size()>N){
            vector <int> tp=v;
            int ba=tp.back();
            tp.pop_back();
            if (!Query(tp)) tp.insert(tp.begin(),ba);
            v=tp;
        }
        set <int> sv;
        for (int j:v) sv.insert(j);
        vector <int> nw;
        rem=orirem;
        for (int j:rem){
            if (sv.find(j)==sv.end()) nw.push_back(j);
        }
        rem=nw;
        Answer(v);
    }
    Answer(rem);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:30:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |         while (v.size()>N){
      |                ~~~~~~~~^~
dango3.cpp: At global scope:
dango3.cpp:8:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    8 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 336 KB Output is correct
2 Correct 5 ms 560 KB Output is correct
3 Correct 5 ms 336 KB Output is correct
4 Correct 5 ms 564 KB Output is correct
5 Correct 5 ms 336 KB Output is correct
6 Correct 5 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 66 ms 592 KB Output is correct
2 Correct 70 ms 668 KB Output is correct
3 Correct 72 ms 592 KB Output is correct
4 Correct 77 ms 592 KB Output is correct
5 Correct 85 ms 592 KB Output is correct
6 Correct 67 ms 592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 119 ms 760 KB Output is correct
2 Correct 117 ms 780 KB Output is correct
3 Correct 121 ms 760 KB Output is correct
4 Correct 120 ms 592 KB Output is correct
5 Correct 123 ms 592 KB Output is correct
6 Correct 124 ms 592 KB Output is correct