답안 #940480

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940480 2024-03-07T09:47:02 Z borisAngelov Super Dango Maker (JOI22_dango3) C++17
0 / 100
1600 ms 1052 KB
#include "dango3.h"
#include <bits/stdc++.h>

using namespace std;

const int maxn = 10005;
const int maxm = 30;

int n, m;

bool taken[maxn];
vector<int> ans[maxm];

vector<int> without(const vector<int>& v, int pos)
{
    vector<int> result;

    for (int i = 0; i < v.size(); ++i)
    {
        if (i != pos && taken[v[i]] == false)
        {
            result.push_back(v[i]);
        }
    }

    return result;
}

void Solve(int N, int M)
{
    n = N;
    m = M;

    for (int i = 1; i <= n * m; ++i)
    {
        taken[i] = false;
    }

    int currm = m;

    for (int i = 1; i <= m; ++i)
    {
        vector<int> active;

        for (int j = 1; j <= n * m; ++j)
        {
            if (taken[j] == false)
            {
                active.push_back(j);
            }
        }

        if (active.size() == n - 1)
        {
            for (int j = 0; j < active.size(); ++j)
            {
                ans[i].push_back(active[j]);
            }

            break;
        }

        ans[i].push_back(active[0]);
        taken[active[0]] = true;

        for (int j = 1; j < active.size(); ++j)
        {
            if (Query(without(active, -1)) == Query(without(active, j)))
            {
                ans[i].push_back(active[j]);
                taken[active[j]] = true;
            }
        }

        for (int j = 0; j < n; ++j)
        {
            cout << ans[i][j] << ' ';
        }

        cout << endl;
    }

    for (int i = 1; i <= m; ++i)
    {
        Answer(ans[i]);
    }
}

Compilation message

dango3.cpp: In function 'std::vector<int> without(const std::vector<int>&, int)':
dango3.cpp:18:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for (int i = 0; i < v.size(); ++i)
      |                     ~~^~~~~~~~~~
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:53:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   53 |         if (active.size() == n - 1)
      |             ~~~~~~~~~~~~~~^~~~~~~~
dango3.cpp:55:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |             for (int j = 0; j < active.size(); ++j)
      |                             ~~^~~~~~~~~~~~~~~
dango3.cpp:66:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |         for (int j = 1; j < active.size(); ++j)
      |                         ~~^~~~~~~~~~~~~~~
dango3.cpp:39:9: warning: unused variable 'currm' [-Wunused-variable]
   39 |     int currm = m;
      |         ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Do not print anything to standard output
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 348 KB Do not print anything to standard output
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 652 ms 644 KB Do not print anything to standard output
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1600 ms 1052 KB Do not print anything to standard output
2 Halted 0 ms 0 KB -