Submission #247182

# Submission time Handle Problem Language Result Execution time Memory
247182 2020-07-11T07:34:21 Z dantoh000 Mouse (info1cup19_mouse) C++14
38 / 100
298 ms 384 KB
#include <bits/stdc++.h>
#include "grader.h"
int n;
int Query(vector<int> q){
    int k = query(q);
    if (k == n) exit(0);//return n;
    else return k;
}
void solve(int N){
    n = N;
    vector<int> q(N);
    vector<int> ord(N);
    for (int i = 0; i < N; i++){
        q[i] = i+1;
        ord[i] = i;
    }
    srand(time(NULL));
    random_shuffle(ord.begin(),ord.end());
    vector<int> done(N,0);
    for (int I = 0; I < N; I++){
        int i = ord[I];
        if (done[i]) continue;
        int cur = Query(q);
        vector<int> C;
        for (int J = I+1; J < N ;J++){
            int j = ord[J];
            swap(q[i],q[j]);
            int K = Query(q) - cur;
            if (K == 2){
                done[i] = done[j] = 1;
                break;
            }
            else if (K == -2){
                swap(q[i],q[j]);
                done[i] = done[j] = 1;
                break;
            }
            else if (K == 1){
                C.push_back(j);
            }
            swap(q[i],q[j]);
        }
        if (C.size() == 2){
            swap(q[i],q[C[0]]);
            swap(q[i],q[C[1]]);
            int K = Query(q) - cur;
            if (K == 3){
                done[i] =done[C[0]] = done[C[1]] = 1;
            }
            else if (K == 2){
                done[i] = done[C[0]] = 1;
            }
            else{
                swap(q[i],q[C[1]]);
                swap(q[i],q[C[0]]);
                swap(q[i],q[C[1]]);
                swap(q[i],q[C[0]]);
                done[i] = done[C[1]] = 1;
            }
        }
        done[i] = 1;
    }
    for (int i = 0; i < N; i++) assert(done[i]);
    Query(q);
    return;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Correct! Number of queries: 22
2 Correct 4 ms 304 KB Correct! Number of queries: 7
3 Correct 5 ms 384 KB Correct! Number of queries: 15
4 Correct 5 ms 256 KB Correct! Number of queries: 20
5 Correct 5 ms 256 KB Correct! Number of queries: 14
6 Correct 5 ms 256 KB Correct! Number of queries: 17
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Correct! Number of queries: 22
2 Correct 4 ms 304 KB Correct! Number of queries: 7
3 Correct 5 ms 384 KB Correct! Number of queries: 15
4 Correct 5 ms 256 KB Correct! Number of queries: 20
5 Correct 5 ms 256 KB Correct! Number of queries: 14
6 Correct 5 ms 256 KB Correct! Number of queries: 17
7 Correct 16 ms 256 KB Correct! Number of queries: 900
8 Correct 16 ms 256 KB Correct! Number of queries: 900
9 Correct 16 ms 384 KB Correct! Number of queries: 800
10 Correct 19 ms 256 KB Correct! Number of queries: 1000
11 Correct 13 ms 384 KB Correct! Number of queries: 700
12 Correct 16 ms 384 KB Correct! Number of queries: 900
13 Correct 15 ms 384 KB Correct! Number of queries: 800
14 Correct 19 ms 256 KB Correct! Number of queries: 900
15 Correct 18 ms 256 KB Correct! Number of queries: 900
16 Correct 15 ms 256 KB Correct! Number of queries: 900
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Correct! Number of queries: 22
2 Correct 4 ms 304 KB Correct! Number of queries: 7
3 Correct 5 ms 384 KB Correct! Number of queries: 15
4 Correct 5 ms 256 KB Correct! Number of queries: 20
5 Correct 5 ms 256 KB Correct! Number of queries: 14
6 Correct 5 ms 256 KB Correct! Number of queries: 17
7 Correct 16 ms 256 KB Correct! Number of queries: 900
8 Correct 16 ms 256 KB Correct! Number of queries: 900
9 Correct 16 ms 384 KB Correct! Number of queries: 800
10 Correct 19 ms 256 KB Correct! Number of queries: 1000
11 Correct 13 ms 384 KB Correct! Number of queries: 700
12 Correct 16 ms 384 KB Correct! Number of queries: 900
13 Correct 15 ms 384 KB Correct! Number of queries: 800
14 Correct 19 ms 256 KB Correct! Number of queries: 900
15 Correct 18 ms 256 KB Correct! Number of queries: 900
16 Correct 15 ms 256 KB Correct! Number of queries: 900
17 Incorrect 298 ms 256 KB Too many queries
18 Halted 0 ms 0 KB -