Submission #1154965

#TimeUsernameProblemLanguageResultExecution timeMemory
1154965sash01CONSUL (info1cup19_consul)C++20
Compilation error
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; } }

Compilation message (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;
      |                                ^~~