#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int m;
vector<int> done, imsi;
vector<int> type[404];
int query(vector<int> q) {
for(auto x : done) q.push_back(x);
for(auto x : imsi) q.push_back(x);
return Query(q);
}
void find(int u, vector<int> v) {
int s = v.size();
if(s == 1) {
// cout << "add " << v[0] << "\n";
type[u].push_back(v[0]);
return;
}
vector<int> v1 = vector<int>(v.begin(), v.begin()+s/2), v2 = vector<int>(v.begin()+s/2, v.end());
int re = query(v1);
if(re) find(u, v1);
else {
for(auto x : v1) imsi.push_back(x);
}
if(type[u].size() < m && (!re || query(v2))) find(u, v2);
else {
for(auto x : v2) imsi.push_back(x);
}
}
void Solve(int N, int M) {
m = M;
vector<int> v(N*M);
iota(v.begin(), v.end(), 1);
random_device rd;
shuffle(v.begin(), v.end(), mt19937(rd()));
for(int i=0;i<N-1;i++) {
find(i, v);
for(auto x : type[i]) done.push_back(x);
for(auto x : type[i]) v.erase(find(v.begin(), v.end(), x));
imsi.clear();
// for(auto x : v) cout << x << " ";
// cout << i << " " << v.size();
// cout << "DONE------------" << endl;
}
type[N-1] = v;
for(int i=0;i<M;i++) {
vector<int> re;
for(int j=0;j<N;j++) {
re.push_back(type[j][i]);
}
Answer(re);
}
}
Compilation message
dango3.cpp: In function 'void find(int, std::vector<int>)':
dango3.cpp:33:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
33 | if(type[u].size() < m && (!re || query(v2))) find(u, v2);
| ~~~~~~~~~~~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 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 |
19 ms |
544 KB |
Output is correct |
2 |
Correct |
20 ms |
444 KB |
Output is correct |
3 |
Correct |
19 ms |
540 KB |
Output is correct |
4 |
Correct |
20 ms |
468 KB |
Output is correct |
5 |
Correct |
20 ms |
540 KB |
Output is correct |
6 |
Correct |
20 ms |
524 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
595 ms |
636 KB |
Output is correct |
2 |
Correct |
638 ms |
624 KB |
Output is correct |
3 |
Correct |
574 ms |
756 KB |
Output is correct |
4 |
Correct |
550 ms |
748 KB |
Output is correct |
5 |
Correct |
648 ms |
848 KB |
Output is correct |
6 |
Correct |
647 ms |
780 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
870 ms |
980 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |