답안 #940415

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940415 2024-03-07T09:01:26 Z borisAngelov Super Dango Maker (JOI22_dango3) C++17
0 / 100
1170 ms 868 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];

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;
        bool first = true;

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

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

            break;
        }

        for (int j = 0; j < active.size(); ++j)
        {
            vector<int> currQuery;

            for (int k = 0; k < active.size(); ++k)
            {
                if (j != k)
                {
                    currQuery.push_back(active[k]);
                }
            }

            if (Query(currQuery) == currm - 1)
            {
                taken[active[j]] = true;
                ans[i].push_back(active[j]);

                if (ans[i].size() == n)
                {
                    break;
                }
            }
        }

        /*cout << "now " << endl;

        for (int j = 1; j <= n * m; ++j)
        {
            if (taken[j] == true)
            {
                cout << "taken " << j << endl;
            }
        }*/

        --currm;
    }

    /*for (int i = 1; i <= m; ++i)
    {
        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 'void Solve(int, int)':
dango3.cpp:48:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |         if (active.size() == n - 1)
      |             ~~~~~~~~~~~~~~^~~~~~~~
dango3.cpp:50:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |             for (int j = 0; j < active.size(); ++j)
      |                             ~~^~~~~~~~~~~~~~~
dango3.cpp:58:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |         for (int j = 0; j < active.size(); ++j)
      |                         ~~^~~~~~~~~~~~~~~
dango3.cpp:62:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |             for (int k = 0; k < active.size(); ++k)
      |                             ~~^~~~~~~~~~~~~~~
dango3.cpp:75:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   75 |                 if (ans[i].size() == n)
      |                     ~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 600 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 420 ms 868 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1170 ms 768 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -