답안 #969119

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
969119 2024-04-24T14:15:58 Z bachhoangxuan CONSUL (info1cup19_consul) C++17
100 / 100
13 ms 600 KB
#include "grader.h"
#include<bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve(int n)
{
    vector<int> p(n);
    iota(p.begin(),p.end(),1);
    shuffle(p.begin(),p.end(),rng);
    set<int> ss;
    int num=0;
    for(int i=0;i<n && num<min(60,n);i++){
        int x=p[i];
        int k=kth(x);num++;
        if(ss.find(k)!=ss.end()) continue;
        if(num==60) break;
        int d=cnt(k);num++;
        if(3*d>n){
            say_answer(k);
            return;
        }
        ss.insert(k);
    }
    say_answer(-1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 436 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 440 KB Output is correct
2 Correct 12 ms 448 KB Output is correct
3 Correct 4 ms 444 KB Output is correct
4 Correct 4 ms 444 KB Output is correct
5 Correct 10 ms 436 KB Output is correct
6 Correct 11 ms 444 KB Output is correct
7 Correct 12 ms 440 KB Output is correct
8 Correct 13 ms 448 KB Output is correct
9 Correct 10 ms 444 KB Output is correct
10 Correct 12 ms 440 KB Output is correct
11 Correct 12 ms 448 KB Output is correct
12 Correct 12 ms 600 KB Output is correct
13 Correct 12 ms 600 KB Output is correct
14 Correct 11 ms 444 KB Output is correct