#include "grader.h"
#include<bits/stdc++.h>
#define ll int
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(ll n)
{
ll q=n>50?2400:n>7?400:50, cnt=-1;
vector <vector <ll>> p(n+1, vector <ll> (n+1, 1));
vector <ll> crr(n);
while (1)
{
cnt++;
if (cnt%n==0)
{
iota(crr.begin(), crr.end(), 1);
shuffle(crr.begin(), crr.end(), rng);
}
else rotate(crr.begin(), crr.begin()+1, crr.end());
ll cnt=0;
for (ll i=0; i<n; i++)
cnt+=p[i+1][crr[i]];
if (!cnt) continue;
ll q=query(crr);
if (q==n) return;
if (!q)
{
for (ll j=0; j<n; j++)
p[j+1][crr[j]]=0;
bool ok=1;
for (ll j=1; j<=n; j++)
{
ll cnt=0;
for (ll k=1; k<=n; k++)
cnt+=p[j][k];
if (cnt>1) ok=0;
}
if (ok)
{
vector <ll> ans;
for (ll j=1; j<=n; j++)
for (ll k=1; k<=n; k++)
if (p[j][k]) {ans.pb(k); break;}
query(ans); return;
}
}
}
}
Compilation message
mouse.cpp: In function 'void solve(int)':
mouse.cpp:16:8: warning: unused variable 'q' [-Wunused-variable]
16 | ll q=n>50?2400:n>7?400:50, cnt=-1;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 63 |
2 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 15 |
3 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 33 |
4 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 42 |
5 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 29 |
6 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 37 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 63 |
2 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 15 |
3 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 33 |
4 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 42 |
5 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 29 |
6 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 37 |
7 |
Correct |
5 ms |
344 KB |
Correct! Number of queries: 800 |
8 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 1000 |
9 |
Correct |
4 ms |
344 KB |
Correct! Number of queries: 700 |
10 |
Correct |
5 ms |
344 KB |
Correct! Number of queries: 800 |
11 |
Correct |
3 ms |
600 KB |
Correct! Number of queries: 600 |
12 |
Correct |
5 ms |
344 KB |
Correct! Number of queries: 800 |
13 |
Correct |
6 ms |
344 KB |
Correct! Number of queries: 700 |
14 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 800 |
15 |
Correct |
6 ms |
344 KB |
Correct! Number of queries: 900 |
16 |
Correct |
5 ms |
344 KB |
Correct! Number of queries: 800 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 63 |
2 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 15 |
3 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 33 |
4 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 42 |
5 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 29 |
6 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 37 |
7 |
Correct |
5 ms |
344 KB |
Correct! Number of queries: 800 |
8 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 1000 |
9 |
Correct |
4 ms |
344 KB |
Correct! Number of queries: 700 |
10 |
Correct |
5 ms |
344 KB |
Correct! Number of queries: 800 |
11 |
Correct |
3 ms |
600 KB |
Correct! Number of queries: 600 |
12 |
Correct |
5 ms |
344 KB |
Correct! Number of queries: 800 |
13 |
Correct |
6 ms |
344 KB |
Correct! Number of queries: 700 |
14 |
Correct |
7 ms |
344 KB |
Correct! Number of queries: 800 |
15 |
Correct |
6 ms |
344 KB |
Correct! Number of queries: 900 |
16 |
Correct |
5 ms |
344 KB |
Correct! Number of queries: 800 |
17 |
Runtime error |
148 ms |
684 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |