Submission #1052736

# Submission time Handle Problem Language Result Execution time Memory
1052736 2024-08-10T20:07:46 Z j_vdd16 Super Dango Maker (JOI22_dango3) C++17
0 / 100
1366 ms 1080 KB
#include <algorithm>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define loop(X, N) for(int X = 0; X < (N); X++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;

#include "dango3.h"

void Solve(int n, int m) {
    int colorCount = 1;
    vi color(n * m);
    color[0] = 0;
    vvi byColor(n);
    byColor[0].push_back(0);

    for (int i = 1; i < n * m; i++) {
        vi x;
        for (int j = i; j < n * m; j++)
            x.push_back(j);

        loop(j, colorCount) {
            for (int k = 1; k < byColor[j].size(); k++) {
                x.push_back(byColor[j][k]);
            }
        }

        int res = Query(x);
        if (res == m - 1) {
            color[i] = colorCount;
            byColor[colorCount].push_back(i);
            colorCount++;
        }
        else {
            int l = 0, r = colorCount - 1;
            while (l < r) {
                int middle = (l + r) / 2;

                vi x;
                for (int j = i; j < n * m; j++)
                    x.push_back(j);

                for (int j = l; j <= middle; j++) {
                    for (int k = 1; k < byColor[j].size(); k++) {
                        x.push_back(byColor[j][k]);
                    }
                }

                res = Query(x);
                if (res == m - 1) {
                    l = middle + 1;
                }
                else {
                    r = middle;
                }
            }

            color[i] = l;
            byColor[l].push_back(i);
        }
    }

    loop(i, m) {
        vi x;
        loop(j, n) {
            x.push_back(byColor[j][i]);
        }

        Answer(x);
    }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:45:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |             for (int k = 1; k < byColor[j].size(); k++) {
      |                             ~~^~~~~~~~~~~~~~~~~~~
dango3.cpp:66:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |                     for (int k = 1; k < byColor[j].size(); k++) {
      |                                     ~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 421 ms 852 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1366 ms 1080 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -