답안 #971695

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
971695 2024-04-29T07:52:34 Z 12345678 Super Dango Maker (JOI22_dango3) C++17
22 / 100
2122 ms 808 KB
#include "dango3.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=1e4+5;

mt19937 rng(time(0));

int used[nx], n, m, p[nx];
vector<pair<int, int>> s;

int query()
{
    vector<int> qrs;
    for (int i=1; i<=n*m; i++) if (!used[i]) qrs.push_back(i);
    return Query(qrs);
}

void Solve(int N, int M) {
    n=N, m=M;
    vector<pair<int, int>> s;
    for (int i=1; i<=N*M; i++) s.push_back({rng(), i});
    sort(s.begin(), s.end());
    for (int i=1; i<=N*M; i++) p[s[i-1].second]=i;
    for (int i=M; i>=2; i--)
    {
        vector<int> res;
        for (int j=1; j<=N*M; j++)
        {
            if (res.size()==N) break;
            if (used[p[j]]) continue;
            used[p[j]]=1;
            if (query()==i-1) res.push_back(p[j]);
            else used[p[j]]=0;
        }
        Answer(res);
    }
    vector<int> res;
    for (int i=1; i<=N*M; i++) if (!used[p[i]]) res.push_back(p[i]);
    Answer(res);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:31:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 |             if (res.size()==N) break;
      |                 ~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 536 KB Output is correct
2 Correct 15 ms 344 KB Output is correct
3 Correct 14 ms 348 KB Output is correct
4 Correct 14 ms 596 KB Output is correct
5 Correct 15 ms 348 KB Output is correct
6 Correct 17 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 485 ms 672 KB Output is correct
2 Correct 502 ms 668 KB Output is correct
3 Correct 610 ms 672 KB Output is correct
4 Correct 560 ms 696 KB Output is correct
5 Correct 464 ms 692 KB Output is correct
6 Correct 492 ms 692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2122 ms 808 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -