답안 #762880

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
762880 2023-06-21T22:55:09 Z Trunkty CONSUL (info1cup19_consul) C++14
85 / 100
1000 ms 304 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll

#include "grader.h"

map<int,int> mp;
bool vis[1005];

void solve(int n){
    for(int i=1;i<=n;i++){
        vis[i] = false;
    }
    mp.clear();
    srand(314);
    for(int i=1;i<=50;i++){
        int curr = rand()%n+1;
        while(vis[curr]){
            curr = rand()%n+1;
        }
        vis[curr] = true;
        mp[kth(curr)]++;
    }
    vector<vector<int>> v;
    for(pair<int,int> i:mp){
        v.push_back({i.second,i.first});
    }
    sort(v.begin(),v.end(),greater<vector<int>>());
    int vs = v.size();
    for(int i=0;i<min(vs,10);i++){
        if(cnt(v[i][1])>n/3){
            say_answer(v[i][1]);
            return;
        }
    }
    say_answer(-1);
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3041 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 208 KB Output is correct
2 Correct 20 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 296 KB Output is correct
2 Correct 39 ms 300 KB Output is correct
3 Correct 46 ms 208 KB Output is correct
4 Correct 35 ms 292 KB Output is correct
5 Correct 36 ms 300 KB Output is correct
6 Correct 48 ms 292 KB Output is correct
7 Correct 46 ms 292 KB Output is correct
8 Correct 36 ms 304 KB Output is correct
9 Correct 50 ms 208 KB Output is correct
10 Correct 50 ms 208 KB Output is correct
11 Correct 48 ms 300 KB Output is correct
12 Correct 26 ms 208 KB Output is correct
13 Correct 62 ms 292 KB Output is correct
14 Correct 40 ms 208 KB Output is correct