답안 #544537

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
544537 2022-04-02T09:12:09 Z Jarif_Rahman Super Dango Maker (JOI22_dango3) C++17
100 / 100
1791 ms 488 KB
#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--;
    }
}

Compilation message

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){
      |         ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 10 ms 364 KB Output is correct
3 Correct 10 ms 368 KB Output is correct
4 Correct 9 ms 340 KB Output is correct
5 Correct 11 ms 372 KB Output is correct
6 Correct 9 ms 368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 334 ms 412 KB Output is correct
2 Correct 337 ms 408 KB Output is correct
3 Correct 278 ms 340 KB Output is correct
4 Correct 349 ms 412 KB Output is correct
5 Correct 326 ms 340 KB Output is correct
6 Correct 325 ms 408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1622 ms 480 KB Output is correct
2 Correct 1760 ms 488 KB Output is correct
3 Correct 1719 ms 488 KB Output is correct
4 Correct 1528 ms 480 KB Output is correct
5 Correct 1640 ms 484 KB Output is correct
6 Correct 1791 ms 488 KB Output is correct