Submission #696113

# Submission time Handle Problem Language Result Execution time Memory
696113 2023-02-05T13:45:36 Z hpesoj Super Dango Maker (JOI22_dango3) C++17
100 / 100
3750 ms 672 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> sticks[m+1];
	sticks[1].pb(1);
	bool b[n*m+1];
	for(int i = 2; i <= n * m; i++){
		int lo = 1, hi = m;
		while(lo < hi){
			int mid = (lo + hi) >> 1;
			vector <int> tmp;
			memset(b, 0, sizeof(b));
			for(int j = 0; j < sticks[mid].size(); j++) b[sticks[mid][j]] = 1;
			b[i] = 1;
			for(int j = 1; j <= n * m; j++) if(!b[j]) tmp.pb(j);
			if(Query(tmp) == m-1) hi = mid;
			else lo = mid + 1;
		}
		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:22:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |    for(int j = 0; j < sticks[mid].size(); j++) b[sticks[mid][j]] = 1;
      |                   ~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory 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 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 340 KB Output is correct
2 Correct 28 ms 368 KB Output is correct
3 Correct 25 ms 372 KB Output is correct
4 Correct 29 ms 340 KB Output is correct
5 Correct 28 ms 364 KB Output is correct
6 Correct 29 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 945 ms 460 KB Output is correct
2 Correct 890 ms 436 KB Output is correct
3 Correct 906 ms 564 KB Output is correct
4 Correct 956 ms 556 KB Output is correct
5 Correct 909 ms 452 KB Output is correct
6 Correct 931 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3750 ms 672 KB Output is correct
2 Correct 3727 ms 664 KB Output is correct
3 Correct 3696 ms 556 KB Output is correct
4 Correct 3710 ms 624 KB Output is correct
5 Correct 3652 ms 596 KB Output is correct
6 Correct 3677 ms 600 KB Output is correct