Submission #560091

# Submission time Handle Problem Language Result Execution time Memory
560091 2022-05-11T04:01:55 Z two_sides Super Dango Maker (JOI22_dango3) C++17
100 / 100
3948 ms 732 KB
#include "dango3.h"
#include <vector>
#include <iostream>

namespace {
    using namespace std;
}

void Solve(int n, int m) {
    vector<vector<int>> a(m);
    vector<char> v(n * m + 1);
    for (int i = 1; i <= n * m; i++) {
        int lo = 0, hi = m - 1;
        while (a[lo].size() == n) lo++;
        while (hi && a[hi - 1].empty()) hi--;
        while (lo < hi) {
            int mi = (lo + hi) / 2;
            fill(v.begin(), v.end(), 0);
            for (int j : a[mi])
                v[j] = true;
            v[i] = true;
            vector<int> b;
            for (int j = 1; j <= n * m; j++)
                if (!v[j]) b.push_back(j);
            if (m == Query(b) + 1) hi = mi;
            else lo = mi + 1;
        }
        a[hi].push_back(i);
    }
    for (int i = 0; i < m; i++)
        Answer(a[i]);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:14:29: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |         while (a[lo].size() == n) lo++;
      |                ~~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 364 KB Output is correct
2 Correct 23 ms 340 KB Output is correct
3 Correct 31 ms 356 KB Output is correct
4 Correct 31 ms 364 KB Output is correct
5 Correct 13 ms 340 KB Output is correct
6 Correct 13 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 728 ms 564 KB Output is correct
2 Correct 762 ms 572 KB Output is correct
3 Correct 1026 ms 548 KB Output is correct
4 Correct 1016 ms 436 KB Output is correct
5 Correct 405 ms 564 KB Output is correct
6 Correct 369 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2918 ms 676 KB Output is correct
2 Correct 3008 ms 732 KB Output is correct
3 Correct 3948 ms 548 KB Output is correct
4 Correct 3946 ms 576 KB Output is correct
5 Correct 1538 ms 648 KB Output is correct
6 Correct 1414 ms 588 KB Output is correct