답안 #696111

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
696111 2023-02-05T13:38:27 Z hpesoj Super Dango Maker (JOI22_dango3) C++17
22 / 100
10000 ms 468 KB
#include <bits/stdc++.h>
#include "dango3.h"
#define pi pair <int, int>
#define ppi pair <pi, int>
#define fi first
#define se second
#define pb push_back
using namespace std;

void Solve(int n, int m) {
	vector <int> v;
	for(int i = 1; i <= n * m; i++) v.pb(i);
	vector <int> sticks[m+1];
	sticks[1].pb(1);
	for(int i = 2; i <= n * m; i++){
		int lo = 1, hi = m;
		while(lo < hi){
			int mid = (lo + hi) >> 1;
			for(int j = 0; j < sticks[mid].size(); j++) v.erase(find(v.begin(), v.end(), sticks[mid][j]));
			v.erase(find(v.begin(), v.end(), i));
			if(Query(v) == m-1) hi = mid;
			else lo = mid + 1;
			v.pb(i);
			for(int j = 0; j < sticks[mid].size(); j++) v.pb(sticks[mid][j]);
		}
		sticks[lo].pb(i);
	}
	for(int i = 1; i <= m; i++) Answer(sticks[i]);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:19:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |    for(int j = 0; j < sticks[mid].size(); j++) v.erase(find(v.begin(), v.end(), sticks[mid][j]));
      |                   ~~^~~~~~~~~~~~~~~~~~~~
dango3.cpp:24:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |    for(int j = 0; j < sticks[mid].size(); j++) v.pb(sticks[mid][j]);
      |                   ~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 352 KB Output is correct
2 Correct 72 ms 352 KB Output is correct
3 Correct 63 ms 340 KB Output is correct
4 Correct 63 ms 360 KB Output is correct
5 Correct 72 ms 348 KB Output is correct
6 Correct 70 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4193 ms 404 KB Output is correct
2 Correct 4214 ms 428 KB Output is correct
3 Correct 3802 ms 436 KB Output is correct
4 Correct 3742 ms 428 KB Output is correct
5 Correct 4395 ms 444 KB Output is correct
6 Correct 4402 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 10089 ms 468 KB Time limit exceeded
2 Halted 0 ms 0 KB -