답안 #565106

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
565106 2022-05-20T09:41:55 Z jeff Super Dango Maker (JOI22_dango3) C++17
100 / 100
3803 ms 640 KB
#include <bits/stdc++.h>
#include "dango3.h"
using namespace std;

void Solve(int N, int M) {
    int l, h, c, i, j, k;
    bool e;
    vector<vector<int> > r;
    vector<int> f, nv;
    for (i = 0; i < N * M; ++i) {
        if ((r.empty() || !r.back().empty()) && r.size() < M) r.push_back(nv);
        for (l = 0; r[l].size() >= N; ++l);
        h = r.size() - 1;
        while (l < h) {
            c = (l + h) / 2;
            for (j = i + 1; j < N * M; ++j) f.push_back(j);
            for (j = c + 1; j < r.size(); ++j) for (k = 0; k < r[j].size(); ++k) f.push_back(r[j][k]);
            for (j = 0; j < f.size(); ++j) ++f[j];
            e = (Query(f) == M - c - 1);
            (e ? h : l) = c + !e;
            f.clear();
        }
        r[l].push_back(i);
    }
    for (i = 0; i < r.size(); ++i) for (j = 0; j < r[i].size(); ++j) ++r[i][j];
    for (i = 0; i < M; ++i) Answer(r[i]);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:11:58: warning: comparison of integer expressions of different signedness: 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |         if ((r.empty() || !r.back().empty()) && r.size() < M) r.push_back(nv);
      |                                                 ~~~~~~~~~^~~
dango3.cpp:12:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |         for (l = 0; r[l].size() >= N; ++l);
      |                     ~~~~~~~~~~~~^~~~
dango3.cpp:17:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             for (j = c + 1; j < r.size(); ++j) for (k = 0; k < r[j].size(); ++k) f.push_back(r[j][k]);
      |                             ~~^~~~~~~~~~
dango3.cpp:17:62: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             for (j = c + 1; j < r.size(); ++j) for (k = 0; k < r[j].size(); ++k) f.push_back(r[j][k]);
      |                                                            ~~^~~~~~~~~~~~~
dango3.cpp:18:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |             for (j = 0; j < f.size(); ++j) ++f[j];
      |                         ~~^~~~~~~~~~
dango3.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for (i = 0; i < r.size(); ++i) for (j = 0; j < r[i].size(); ++j) ++r[i][j];
      |                 ~~^~~~~~~~~~
dango3.cpp:25:50: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for (i = 0; i < r.size(); ++i) for (j = 0; j < r[i].size(); ++j) ++r[i][j];
      |                                                ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 340 KB Output is correct
2 Correct 15 ms 368 KB Output is correct
3 Correct 31 ms 372 KB Output is correct
4 Correct 25 ms 340 KB Output is correct
5 Correct 9 ms 364 KB Output is correct
6 Correct 11 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 532 ms 428 KB Output is correct
2 Correct 520 ms 428 KB Output is correct
3 Correct 927 ms 440 KB Output is correct
4 Correct 932 ms 560 KB Output is correct
5 Correct 296 ms 432 KB Output is correct
6 Correct 250 ms 432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2029 ms 508 KB Output is correct
2 Correct 2043 ms 508 KB Output is correct
3 Correct 3748 ms 524 KB Output is correct
4 Correct 3803 ms 640 KB Output is correct
5 Correct 1000 ms 508 KB Output is correct
6 Correct 868 ms 520 KB Output is correct