답안 #930697

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
930697 2024-02-20T09:37:55 Z Tuanlinh123 Mouse (info1cup19_mouse) C++17
34 / 100
163 ms 684 KB
#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 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;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct! Number of queries: 35
2 Correct 0 ms 344 KB Correct! Number of queries: 15
3 Correct 1 ms 344 KB Correct! Number of queries: 40
4 Correct 0 ms 344 KB Correct! Number of queries: 49
5 Correct 0 ms 344 KB Correct! Number of queries: 49
6 Correct 1 ms 344 KB Correct! Number of queries: 52
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct! Number of queries: 35
2 Correct 0 ms 344 KB Correct! Number of queries: 15
3 Correct 1 ms 344 KB Correct! Number of queries: 40
4 Correct 0 ms 344 KB Correct! Number of queries: 49
5 Correct 0 ms 344 KB Correct! Number of queries: 49
6 Correct 1 ms 344 KB Correct! Number of queries: 52
7 Correct 9 ms 340 KB Correct! Number of queries: 1000
8 Correct 6 ms 344 KB Correct! Number of queries: 900
9 Correct 5 ms 344 KB Correct! Number of queries: 800
10 Correct 7 ms 344 KB Correct! Number of queries: 900
11 Correct 5 ms 448 KB Correct! Number of queries: 800
12 Correct 6 ms 344 KB Correct! Number of queries: 900
13 Correct 6 ms 344 KB Correct! Number of queries: 900
14 Correct 7 ms 344 KB Correct! Number of queries: 1000
15 Correct 6 ms 344 KB Correct! Number of queries: 900
16 Correct 8 ms 344 KB Correct! Number of queries: 900
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct! Number of queries: 35
2 Correct 0 ms 344 KB Correct! Number of queries: 15
3 Correct 1 ms 344 KB Correct! Number of queries: 40
4 Correct 0 ms 344 KB Correct! Number of queries: 49
5 Correct 0 ms 344 KB Correct! Number of queries: 49
6 Correct 1 ms 344 KB Correct! Number of queries: 52
7 Correct 9 ms 340 KB Correct! Number of queries: 1000
8 Correct 6 ms 344 KB Correct! Number of queries: 900
9 Correct 5 ms 344 KB Correct! Number of queries: 800
10 Correct 7 ms 344 KB Correct! Number of queries: 900
11 Correct 5 ms 448 KB Correct! Number of queries: 800
12 Correct 6 ms 344 KB Correct! Number of queries: 900
13 Correct 6 ms 344 KB Correct! Number of queries: 900
14 Correct 7 ms 344 KB Correct! Number of queries: 1000
15 Correct 6 ms 344 KB Correct! Number of queries: 900
16 Correct 8 ms 344 KB Correct! Number of queries: 900
17 Runtime error 163 ms 684 KB Execution killed with signal 13
18 Halted 0 ms 0 KB -