답안 #401071

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
401071 2021-05-09T10:15:08 Z dolphingarlic Mouse (info1cup19_mouse) C++14
33.4138 / 100
220 ms 200 KB
#include "grader.h"

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

void solve(int N) {
    vector<int> perm(N);
    iota(perm.begin(), perm.end(), 1);
    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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct! Number of queries: 34
2 Correct 1 ms 200 KB Correct! Number of queries: 12
3 Correct 1 ms 200 KB Correct! Number of queries: 25
4 Correct 1 ms 200 KB Correct! Number of queries: 32
5 Correct 2 ms 200 KB Correct! Number of queries: 32
6 Correct 1 ms 200 KB Correct! Number of queries: 33
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct! Number of queries: 34
2 Correct 1 ms 200 KB Correct! Number of queries: 12
3 Correct 1 ms 200 KB Correct! Number of queries: 25
4 Correct 1 ms 200 KB Correct! Number of queries: 32
5 Correct 2 ms 200 KB Correct! Number of queries: 32
6 Correct 1 ms 200 KB Correct! Number of queries: 33
7 Correct 21 ms 200 KB Correct! Number of queries: 1400
8 Correct 25 ms 200 KB Correct! Number of queries: 1500
9 Correct 21 ms 200 KB Correct! Number of queries: 1200
10 Correct 24 ms 200 KB Correct! Number of queries: 1600
11 Correct 16 ms 200 KB Correct! Number of queries: 1000
12 Correct 25 ms 200 KB Correct! Number of queries: 1300
13 Correct 22 ms 200 KB Correct! Number of queries: 1300
14 Correct 26 ms 200 KB Correct! Number of queries: 1400
15 Correct 26 ms 200 KB Correct! Number of queries: 1600
16 Correct 26 ms 200 KB Correct! Number of queries: 1500
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Correct! Number of queries: 34
2 Correct 1 ms 200 KB Correct! Number of queries: 12
3 Correct 1 ms 200 KB Correct! Number of queries: 25
4 Correct 1 ms 200 KB Correct! Number of queries: 32
5 Correct 2 ms 200 KB Correct! Number of queries: 32
6 Correct 1 ms 200 KB Correct! Number of queries: 33
7 Correct 21 ms 200 KB Correct! Number of queries: 1400
8 Correct 25 ms 200 KB Correct! Number of queries: 1500
9 Correct 21 ms 200 KB Correct! Number of queries: 1200
10 Correct 24 ms 200 KB Correct! Number of queries: 1600
11 Correct 16 ms 200 KB Correct! Number of queries: 1000
12 Correct 25 ms 200 KB Correct! Number of queries: 1300
13 Correct 22 ms 200 KB Correct! Number of queries: 1300
14 Correct 26 ms 200 KB Correct! Number of queries: 1400
15 Correct 26 ms 200 KB Correct! Number of queries: 1600
16 Correct 26 ms 200 KB Correct! Number of queries: 1500
17 Runtime error 220 ms 200 KB Execution killed with signal 13
18 Halted 0 ms 0 KB -