답안 #246731

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
246731 2020-07-10T04:07:12 Z SomeoneUnknown CONSUL (info1cup19_consul) C++14
100 / 100
37 ms 432 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
void solve(int n)
{
    /// insert your code
    /// for example
    int polls = 54;
    int fchecks = 6;
    vector<int> surveyres;
    if(n <= 60){
        for(int i = 1; i <= n; i++){
            surveyres.push_back(kth(i));
        }
        sort(surveyres.begin(), surveyres.end());
        int prv = 0;
        int amt = 0;
        for(int i = 0; i < n; i++){
            if(prv != surveyres[i]){
                prv = surveyres[i];
                amt = 0;
            }
            ++amt;
            if(amt * 3 > n){
                say_answer(prv);
                return;
            }
        }
        say_answer(-1);
        return;
    }
}

Compilation message

consul.cpp: In function 'void solve(int)':
consul.cpp:8:9: warning: unused variable 'polls' [-Wunused-variable]
     int polls = 54;
         ^~~~~
consul.cpp:9:9: warning: unused variable 'fchecks' [-Wunused-variable]
     int fchecks = 6;
         ^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 432 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 128 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 256 KB Output is correct
12 Correct 6 ms 256 KB Output is correct
13 Correct 6 ms 256 KB Output is correct
14 Correct 6 ms 256 KB Output is correct