답안 #996295

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
996295 2024-06-10T11:57:46 Z abczz Super Dango Maker (JOI22_dango3) C++17
7 / 100
111 ms 1128 KB
#include "dango3.h"
#include <iostream>
#include <vector>
#include <map>
#include <random>
#include <algorithm>
#define ll int

using namespace std;

void Solve(int N, int M) {
  mt19937_64 mt(69);
  vector <ll> perm;
  map <ll, ll> mp;
  ll pos[10001];
  ll s;
  for (int i=1; i<=N*M; ++i) {
    perm.push_back(i);
  }
  shuffle(perm.begin(), perm.end(), mt);
  for (int i=0; i<N*M; ++i) {
    mp[i] = perm[i];
    pos[perm[i]] = i;
  }
  vector <ll> V;
  for (int i=0; i<M; ++i) {
    for (auto [x, y] : mp) {
      V.push_back(y);
      if (V.size() >= N) {
        s = Query(V);
        if (s) break;
      }
    }
    for (int j=0; j<(ll)V.size(); ++j) {
      auto u = V[j];
      swap(V[j], V.back());
      V.pop_back();
      s = Query(V);
      if (!s) {
        V.push_back(u);
        swap(V[j], V.back());
      }
      else --j;
      if (V.size() == N) break;
    }
    for (auto u : V) {
      mp.erase(pos[u]);
    }
    Answer(V);
    V.clear();
  }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:29:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |       if (V.size() >= N) {
      |           ~~~~~~~~~^~~~
dango3.cpp:44:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |       if (V.size() == N) break;
      |           ~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 3 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 596 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 592 KB Output is correct
6 Correct 3 ms 476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 53 ms 836 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 111 ms 1128 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -