Submission #930703

#TimeUsernameProblemLanguageResultExecution timeMemory
930703Tuanlinh123Mouse (info1cup19_mouse)C++17
34 / 100
148 ms684 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...