Submission #314558

#TimeUsernameProblemLanguageResultExecution timeMemory
314558balbitCONSUL (info1cup19_consul)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #ifndef BALBIT #include "grader.h" #endif #define ALL(x) (x).begin(), (x).end() #define SZ(x) (int)(x.size()) #ifdef BALBIT #define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__) template<typename T> void _do(T && x){cerr<<x<<endl;} template<typename T, typename ...S> void _do(T && x, S && ...y){cerr<<x<<", "; _do(y...);} #else #define bug(...) #endif #ifdef BALBIT #endif // BALBIT mt19937 rng (chrono::steady_clock::now().time_since_epoch().count()); void solve(int n) { map<int, int> mp; vector<int> p(n); for (int i = 0; i<n; ++i) p[i] = i; shuffle(ALL(p), rng); int qleft = 60; for (int i = 0; i<n && SZ(mp)+1 < qleft-1; ++i) { mp[kth(p[i]+1)]++; } for (pii & p : mp) { int cc = cnt(p.f+1); if (cc * 3 > n) { say_answer(p.f+1); return; } } assert(0); } #ifdef BALBIT signed main(){ bug(1,2); } #endif // BALBIT

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:34:10: error: 'pii' was not declared in this scope
   34 |     for (pii & p : mp) {
      |          ^~~
consul.cpp:34:18: error: found ':' in nested-name-specifier, expected '::'
   34 |     for (pii & p : mp) {
      |                  ^
      |                  ::
consul.cpp:34:16: error: 'p' is not a class, namespace, or enumeration
   34 |     for (pii & p : mp) {
      |                ^
In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from consul.cpp:1:
consul.cpp:41:5: error: could not convert '(false ? (void)0 : __assert_fail(((const char*)"0"), ((const char*)"consul.cpp"), 41, ((const char*)(& __PRETTY_FUNCTION__))))' from 'void' to 'bool'
   41 |     assert(0);
      |     ^~~~~~
      |     |
      |     void
consul.cpp:42:1: error: expected primary-expression before '}' token
   42 | }
      | ^
consul.cpp:41:15: error: expected ')' before '}' token
   41 |     assert(0);
      |               ^
      |               )
   42 | }
      | ~              
consul.cpp:34:9: note: to match this '('
   34 |     for (pii & p : mp) {
      |         ^
consul.cpp:42:1: error: expected primary-expression before '}' token
   42 | }
      | ^