//Challenge: Accepted
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
while (l != r) cout << *l << " ", l++;
cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 100005
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
namespace {
int query(vector<int> &x) {
pary(x.begin(), x.end());
return Query(x);
}
} // namespace
void Solve(int N, int M) {
srand(time(NULL));
vector<bool> vis(N*M, 0);
for (int i = 0; i < M; i++) {
vector<int> v;
for (int j = 0;j < N*M;j++) {
if (!vis[j]) {
v.push_back(j+1);
}
}
random_shuffle(v.begin(), v.end());
//debug("poss");
//pary(v.begin(), v.end());
vector<int> a;
if (i == M - 1) {
a = v;
} else {
int low = 0, up = v.size();
while (low < up - 1) {
int mid = (low + up) / 2;
vector<int> q(v.begin(), v.begin() + mid);
if (query(q) >= 1) {
up = mid;
} else {
low = mid;
}
}
a.push_back(v[low]);
for (int j = low-1;j >= 0;j--) {
vector<int> q(v.begin(), v.begin() + j);
q.insert(q.end(), a.begin(), a.end());
if (query(q) == 0) {
a.push_back(v[j]);
}
}
}
debug("Answer");
pary(a.begin(), a.end());
Answer(a);
for (int j:a) vis[j-1] = 1;
}
}
Compilation message
dango3.cpp: In function 'int {anonymous}::query(std::vector<int>&)':
dango3.cpp:14:19: warning: statement has no effect [-Wunused-value]
14 | #define pary(...) 0
| ^
dango3.cpp:24:3: note: in expansion of macro 'pary'
24 | pary(x.begin(), x.end());
| ^~~~
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:13:20: warning: statement has no effect [-Wunused-value]
13 | #define debug(...) 0
| ^
dango3.cpp:66:3: note: in expansion of macro 'debug'
66 | debug("Answer");
| ^~~~~
dango3.cpp:14:19: warning: statement has no effect [-Wunused-value]
14 | #define pary(...) 0
| ^
dango3.cpp:67:3: note: in expansion of macro 'pary'
67 | pary(a.begin(), a.end());
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
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 |
5 ms |
304 KB |
Output is correct |
2 |
Correct |
5 ms |
340 KB |
Output is correct |
3 |
Correct |
6 ms |
304 KB |
Output is correct |
4 |
Correct |
6 ms |
340 KB |
Output is correct |
5 |
Correct |
5 ms |
304 KB |
Output is correct |
6 |
Correct |
5 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
78 ms |
468 KB |
Output is correct |
2 |
Correct |
65 ms |
468 KB |
Output is correct |
3 |
Correct |
74 ms |
468 KB |
Output is correct |
4 |
Correct |
67 ms |
468 KB |
Output is correct |
5 |
Correct |
77 ms |
472 KB |
Output is correct |
6 |
Correct |
72 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
430 ms |
548 KB |
Output is correct |
2 |
Correct |
398 ms |
468 KB |
Output is correct |
3 |
Correct |
310 ms |
552 KB |
Output is correct |
4 |
Correct |
371 ms |
520 KB |
Output is correct |
5 |
Correct |
353 ms |
552 KB |
Output is correct |
6 |
Correct |
403 ms |
528 KB |
Output is correct |