Submission #315015

# Submission time Handle Problem Language Result Execution time Memory
315015 2020-10-22T00:34:55 Z casperwang CONSUL (info1cup19_consul) C++14
100 / 100
27 ms 384 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

const int MAXN = 1000;
int v[MAXN+1];

void solve(int N) {
  srand(time(NULL));
  for (int i = 1; i <= N; i++)
    v[i] = -1;
  for (int i = 1; i <= 25; i++) {
    int p = rand() % N + 1;
    while (v[p] != -1) p = rand() % N + 1;
    v[p] = kth(p);
    int c = cnt(v[p]);
    if (c * 3 > N) {
      say_answer(v[p]);
      return;
    }
  }
  say_answer(-1);
  return;
}

# Verdict Execution time Memory Grader output
1 Correct 13 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 256 KB Output is correct
2 Correct 8 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 256 KB Output is correct
2 Correct 18 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 26 ms 256 KB Output is correct
6 Correct 27 ms 256 KB Output is correct
7 Correct 18 ms 256 KB Output is correct
8 Correct 21 ms 256 KB Output is correct
9 Correct 18 ms 256 KB Output is correct
10 Correct 20 ms 256 KB Output is correct
11 Correct 20 ms 256 KB Output is correct
12 Correct 19 ms 256 KB Output is correct
13 Correct 24 ms 256 KB Output is correct
14 Correct 18 ms 256 KB Output is correct