#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;
vector <vector <ll>> p(n+1, vector <ll> (n+1, 1));
vector <ll> crr(n);
for (ll i=0; i<q-1; i++)
{
if (i%n==0)
{
iota(crr.begin(), crr.end(), 1);
shuffle(crr.begin(), crr.end(), rng);
}
else rotate(crr.begin(), crr.begin()+1, crr.end());
ll q=query(crr);
if (q==n) return;
if (!q) for (ll i=0; i<n; i++)
p[i+1][crr[i]]=0;
}
vector <ll> ans;
for (ll i=1; i<=n; i++)
for (ll j=1; j<=n; j++)
if (p[i][j]) {ans.pb(j); break;}
query(ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 50 |
2 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 32 |
3 |
Incorrect |
1 ms |
344 KB |
Is not a permutation |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 50 |
2 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 32 |
3 |
Incorrect |
1 ms |
344 KB |
Is not a permutation |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct! Number of queries: 50 |
2 |
Correct |
0 ms |
344 KB |
Correct! Number of queries: 32 |
3 |
Incorrect |
1 ms |
344 KB |
Is not a permutation |
4 |
Halted |
0 ms |
0 KB |
- |