답안 #315096

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
315096 2020-10-22T02:27:36 Z casperwang Mouse (info1cup19_mouse) C++14
48 / 100
289 ms 256 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

void solve(int N) {
  vector <int> g(N), ans(N);
  for (int i = 0; i < N; i++)
    g[i] = i+1;
  random_shuffle(g.begin(), g.end());
  int C = query(g), t;
  for (int i = 0; i < N; i++) {
    if (ans[i]) continue;
    int a = 0, b = 0;
    for (int j = i+1; j < N; j++) {
      if (ans[j]) continue;
      swap(g[i], g[j]);
      t = query(g);
      swap(g[i], g[j]);
      if (t == C + 2) {
        ans[i] = g[i];
        ans[j] = g[j];
        swap(g[i], g[j]);
        break;
      } else if (t == C + 1) {
        if (!a) a = j;
        else {
          b = j;
          break;
        }
      }
    }
    swap(g[i], g[a]);
    swap(g[i], g[b]);
    t = query(g);
    if (t >= C + 2) {
      ans[i] = g[i];
      ans[a] = g[a];
      if (t == C + 3)
        ans[b] = g[b];
    } else {
      swap(g[i], g[b]);
      swap(g[i], g[a]);
      swap(g[i], g[b]);
      swap(g[i], g[a]);
      t = query(g);
      ans[i] = g[i];
      ans[b] = g[b];
      if (t == C + 3)
        ans[a] = g[a];
    }
    C = t;
  }
  return;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Correct! Number of queries: 19
2 Correct 0 ms 256 KB Correct! Number of queries: 4
3 Correct 0 ms 256 KB Correct! Number of queries: 8
4 Correct 1 ms 256 KB Correct! Number of queries: 23
5 Correct 1 ms 256 KB Correct! Number of queries: 19
6 Correct 0 ms 256 KB Correct! Number of queries: 11
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Correct! Number of queries: 19
2 Correct 0 ms 256 KB Correct! Number of queries: 4
3 Correct 0 ms 256 KB Correct! Number of queries: 8
4 Correct 1 ms 256 KB Correct! Number of queries: 23
5 Correct 1 ms 256 KB Correct! Number of queries: 19
6 Correct 0 ms 256 KB Correct! Number of queries: 11
7 Correct 5 ms 256 KB Correct! Number of queries: 500
8 Correct 6 ms 256 KB Correct! Number of queries: 500
9 Correct 6 ms 256 KB Correct! Number of queries: 400
10 Correct 7 ms 256 KB Correct! Number of queries: 500
11 Correct 5 ms 256 KB Correct! Number of queries: 400
12 Correct 6 ms 256 KB Correct! Number of queries: 500
13 Correct 6 ms 256 KB Correct! Number of queries: 400
14 Correct 7 ms 256 KB Correct! Number of queries: 500
15 Correct 8 ms 256 KB Correct! Number of queries: 500
16 Correct 7 ms 256 KB Correct! Number of queries: 500
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Correct! Number of queries: 19
2 Correct 0 ms 256 KB Correct! Number of queries: 4
3 Correct 0 ms 256 KB Correct! Number of queries: 8
4 Correct 1 ms 256 KB Correct! Number of queries: 23
5 Correct 1 ms 256 KB Correct! Number of queries: 19
6 Correct 0 ms 256 KB Correct! Number of queries: 11
7 Correct 5 ms 256 KB Correct! Number of queries: 500
8 Correct 6 ms 256 KB Correct! Number of queries: 500
9 Correct 6 ms 256 KB Correct! Number of queries: 400
10 Correct 7 ms 256 KB Correct! Number of queries: 500
11 Correct 5 ms 256 KB Correct! Number of queries: 400
12 Correct 6 ms 256 KB Correct! Number of queries: 500
13 Correct 6 ms 256 KB Correct! Number of queries: 400
14 Correct 7 ms 256 KB Correct! Number of queries: 500
15 Correct 8 ms 256 KB Correct! Number of queries: 500
16 Correct 7 ms 256 KB Correct! Number of queries: 500
17 Incorrect 289 ms 256 KB Too many queries
18 Halted 0 ms 0 KB -