제출 #544537

#제출 시각아이디문제언어결과실행 시간메모리
544537Jarif_RahmanSuper Dango Maker (JOI22_dango3)C++17
100 / 100
1791 ms488 KiB
#include "dango3.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;

namespace {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int next(int a, int b){
        return uniform_int_distribution(a, b)(rng);
    }
}

void Solve(int n, int m){
    vector<int> s;
    for(int i = 1; i <= n*m; i++){
        s.pb(i);
    }

    int c = m;

    while(c > 0){
        vector<int> ss;
        shuffle(s.begin(), s.end(), rng);
        int in = -1;
        while(s.size() > (c-1)*n && ss.size() < n){
            in++;
            int t = s[in];
            s.erase(s.begin()+in);
            ss.pb(t);
            if(Query(s) < c-1){
                s.insert(s.begin()+in, t);
                in++;
                ss.pop_back();
            }
            in--;
        }

        if(ss.size() != n) continue;

        Answer(ss);
        c--;
    }
}

컴파일 시 표준 에러 (stderr) 메시지

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:29:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |         while(s.size() > (c-1)*n && ss.size() < n){
      |               ~~~~~~~~~^~~~~~~~~
dango3.cpp:29:47: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |         while(s.size() > (c-1)*n && ss.size() < n){
      |                                     ~~~~~~~~~~^~~
dango3.cpp:42:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |         if(ss.size() != n) continue;
      |            ~~~~~~~~~~^~~~
dango3.cpp: At global scope:
dango3.cpp:12:9: warning: 'int {anonymous}::next(int, int)' defined but not used [-Wunused-function]
   12 |     int next(int a, int b){
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...