Submission #401074

# Submission time Handle Problem Language Result Execution time Memory
401074 2021-05-09T10:16:56 Z dolphingarlic Mouse (info1cup19_mouse) C++14
33.6092 / 100
222 ms 200 KB
#include "grader.h"

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

void solve(int N) {
    srand(69420);
    vector<int> perm(N);
    iota(perm.begin(), perm.end(), 1);
    random_shuffle(perm.begin(), perm.end());
    vector<bool> known(N, false);
    int prv = -1;
    for (int i = 0; i < N;) {
        if (known[i]) {
            i++;
            continue;
        }
        int baseline = query(perm);
        if (baseline == N) return;

        int found = -1;
        for (int j = i + 1; j < N; j++) {
            swap(perm[i], perm[j]);
            int pot = query(perm);
            if (pot == N) return;
            if (pot > baseline) {
                found = j;
                break;
            }
            swap(perm[i], perm[j]);
        }
        if (~found) {
            if (~prv) known[prv] = true;
            prv = found;
        } else {
            known[i] = true;
            i++;
            prv = -1;
        }
    }
    query(perm);
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 200 KB Correct! Number of queries: 32
2 Correct 2 ms 200 KB Correct! Number of queries: 13
3 Correct 1 ms 200 KB Correct! Number of queries: 26
4 Correct 3 ms 200 KB Correct! Number of queries: 29
5 Correct 1 ms 200 KB Correct! Number of queries: 37
6 Correct 1 ms 200 KB Correct! Number of queries: 36
# Verdict Execution time Memory Grader output
1 Correct 3 ms 200 KB Correct! Number of queries: 32
2 Correct 2 ms 200 KB Correct! Number of queries: 13
3 Correct 1 ms 200 KB Correct! Number of queries: 26
4 Correct 3 ms 200 KB Correct! Number of queries: 29
5 Correct 1 ms 200 KB Correct! Number of queries: 37
6 Correct 1 ms 200 KB Correct! Number of queries: 36
7 Correct 29 ms 200 KB Correct! Number of queries: 1500
8 Correct 21 ms 200 KB Correct! Number of queries: 1500
9 Correct 13 ms 200 KB Correct! Number of queries: 1400
10 Correct 21 ms 200 KB Correct! Number of queries: 1400
11 Correct 22 ms 200 KB Correct! Number of queries: 1200
12 Correct 25 ms 200 KB Correct! Number of queries: 1500
13 Correct 19 ms 200 KB Correct! Number of queries: 1200
14 Correct 28 ms 200 KB Correct! Number of queries: 1400
15 Correct 24 ms 200 KB Correct! Number of queries: 1300
16 Correct 19 ms 200 KB Correct! Number of queries: 1300
# Verdict Execution time Memory Grader output
1 Correct 3 ms 200 KB Correct! Number of queries: 32
2 Correct 2 ms 200 KB Correct! Number of queries: 13
3 Correct 1 ms 200 KB Correct! Number of queries: 26
4 Correct 3 ms 200 KB Correct! Number of queries: 29
5 Correct 1 ms 200 KB Correct! Number of queries: 37
6 Correct 1 ms 200 KB Correct! Number of queries: 36
7 Correct 29 ms 200 KB Correct! Number of queries: 1500
8 Correct 21 ms 200 KB Correct! Number of queries: 1500
9 Correct 13 ms 200 KB Correct! Number of queries: 1400
10 Correct 21 ms 200 KB Correct! Number of queries: 1400
11 Correct 22 ms 200 KB Correct! Number of queries: 1200
12 Correct 25 ms 200 KB Correct! Number of queries: 1500
13 Correct 19 ms 200 KB Correct! Number of queries: 1200
14 Correct 28 ms 200 KB Correct! Number of queries: 1400
15 Correct 24 ms 200 KB Correct! Number of queries: 1300
16 Correct 19 ms 200 KB Correct! Number of queries: 1300
17 Runtime error 222 ms 200 KB Execution killed with signal 13
18 Halted 0 ms 0 KB -