답안 #639691

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
639691 2022-09-11T05:31:54 Z LittleCube Super Dango Maker (JOI22_dango3) C++17
100 / 100
1962 ms 704 KB
#include "dango3.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;

int Query(vector<int> v, vector<int> u)
{
	for(int i : u)
		v.emplace_back(i);
	return Query(v);
}

void Solve(int N, int M)
{
	mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
	vector<int> v;
	for(int i = 1; i <= N * M; i++)
		v.emplace_back(i);
	shuffle(v.begin(), v.end(), rd);
	for(int i = M - 1; i > 0; i--)
	{
		shuffle(v.begin(), v.end(), rd);
		vector<int> ign, ans;
		ans.emplace_back(v.back());
		v.pop_back();
		while(ans.size() < N)
		{
			int k = v.back();
			v.pop_back();
			if(Query(v, ign) == i)
				ans.emplace_back(k);
			else 
				ign.emplace_back(k);
		}
		for(int i : ign)
			v.emplace_back(i);
		Answer(ans);
	}
	Answer(v);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:30:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |   while(ans.size() < N)
      |         ~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 408 KB Output is correct
2 Correct 10 ms 340 KB Output is correct
3 Correct 13 ms 340 KB Output is correct
4 Correct 12 ms 340 KB Output is correct
5 Correct 7 ms 376 KB Output is correct
6 Correct 9 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 326 ms 488 KB Output is correct
2 Correct 354 ms 468 KB Output is correct
3 Correct 344 ms 488 KB Output is correct
4 Correct 346 ms 492 KB Output is correct
5 Correct 357 ms 476 KB Output is correct
6 Correct 331 ms 480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1940 ms 592 KB Output is correct
2 Correct 1962 ms 636 KB Output is correct
3 Correct 1783 ms 628 KB Output is correct
4 Correct 1732 ms 628 KB Output is correct
5 Correct 1587 ms 624 KB Output is correct
6 Correct 1775 ms 704 KB Output is correct