제출 #1154965

#제출 시각아이디문제언어결과실행 시간메모리
1154965sash01CONSUL (info1cup19_consul)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
bool used[12312];
void solve(int n)
{
    std::random_device rd;
    std::mt19937 gen(rd());
    memset(used,0,sizeof(used));
    while(1)
    {
        std::uniform_int_distribution<> d(1, n);
        if(used[d])continue;
        int ans=kth(d);
        if(cnt(ans)>n/3)return ans;
    }
}

컴파일 시 표준 에러 (stderr) 메시지

consul.cpp: In function 'void solve(int)':
consul.cpp:13:16: error: no match for 'operator[]' (operand types are 'bool [12312]' and 'std::uniform_int_distribution<>')
   13 |         if(used[d])continue;
      |                ^
consul.cpp:14:21: error: cannot convert 'std::uniform_int_distribution<>' to 'int'
   14 |         int ans=kth(d);
      |                     ^
      |                     |
      |                     std::uniform_int_distribution<>
In file included from consul.cpp:2:
grader.h:6:13: note:   initializing argument 1 of 'int kth(int)'
    6 | int kth(int k);
      |         ~~~~^
consul.cpp:15:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
   15 |         if(cnt(ans)>n/3)return ans;
      |                                ^~~