Submission #568712

# Submission time Handle Problem Language Result Execution time Memory
568712 2022-05-26T06:01:57 Z joelau Super Dango Maker (JOI22_dango3) C++17
100 / 100
2131 ms 600 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> lst[30],v;

void Solve(int N, int M) {
    for (int i = 0; i < N*M; ++i) v.push_back(i+1);
    while (!v.empty()) {
        int x = v.back(); v.pop_back();
        int low = 0, high = M;
        while (high - low > 1) {
            int mid = (low+high)/2;
            int n = 0;
            for (int i = 0; i < mid; ++i) {
                n += lst[i].size();
                for (int j = 0; j < lst[i].size(); ++j) v.push_back(lst[i][j]);
            }
            int q = Query(v);
            if (q == mid-1) high = mid;
            else low = mid;
            for (int i = 0; i < n; ++i) v.pop_back();
        }
        lst[low].push_back(x);
    }
    for (int i = 0; i < M; ++i) Answer(lst[i]);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:17:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |                 for (int j = 0; j < lst[i].size(); ++j) v.push_back(lst[i][j]);
      |                                 ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 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 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
# Verdict Execution time Memory Grader output
1 Correct 14 ms 368 KB Output is correct
2 Correct 13 ms 340 KB Output is correct
3 Correct 16 ms 304 KB Output is correct
4 Correct 18 ms 404 KB Output is correct
5 Correct 9 ms 368 KB Output is correct
6 Correct 12 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 364 ms 436 KB Output is correct
2 Correct 367 ms 436 KB Output is correct
3 Correct 455 ms 472 KB Output is correct
4 Correct 515 ms 460 KB Output is correct
5 Correct 377 ms 452 KB Output is correct
6 Correct 330 ms 428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1355 ms 512 KB Output is correct
2 Correct 1307 ms 524 KB Output is correct
3 Correct 2131 ms 600 KB Output is correct
4 Correct 2114 ms 488 KB Output is correct
5 Correct 1329 ms 552 KB Output is correct
6 Correct 1346 ms 596 KB Output is correct