제출 #1318400

#제출 시각아이디문제언어결과실행 시간메모리
1318400NurislamCONSUL (info1cup19_consul)C++17
컴파일 에러
0 ms0 KiB
#include "grader.h" //#include "grader.cpp" mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define rnd(l, r) uniform_int_distribution<int> (l,r)(rng) void solve(int n){ vector<int> id(n); iota(id.begin(), id.end(), 1); map<int,int> mp; int ct = 0; while(id.size()) { int c = id[rnd(0, id.size()-1)]; int cur = kth(c); mp[cur] ++ ; ct ++ ; if(mp[cur] > 1) { ct ++ ; if(cnt(cur) > n/3) { say_answer(cur); return; }; }; vector<int> ni; for(int &i : id) if(i != c) ni.push_back(i); swap(ni, id); }; say_answer(1); }

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

consul.cpp:4:1: error: 'mt19937' does not name a type
    4 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      | ^~~~~~~
consul.cpp: In function 'void solve(int)':
consul.cpp:9:9: error: 'vector' was not declared in this scope
    9 |         vector<int> id(n);
      |         ^~~~~~
consul.cpp:9:16: error: expected primary-expression before 'int'
    9 |         vector<int> id(n);
      |                ^~~
consul.cpp:10:14: error: 'id' was not declared in this scope
   10 |         iota(id.begin(), id.end(), 1);
      |              ^~
consul.cpp:10:9: error: 'iota' was not declared in this scope
   10 |         iota(id.begin(), id.end(), 1);
      |         ^~~~
consul.cpp:12:9: error: 'map' was not declared in this scope
   12 |         map<int,int> mp;
      |         ^~~
consul.cpp:12:13: error: expected primary-expression before 'int'
   12 |         map<int,int> mp;
      |             ^~~
consul.cpp:5:19: error: 'uniform_int_distribution' was not declared in this scope
    5 | #define rnd(l, r) uniform_int_distribution<int> (l,r)(rng)
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~
consul.cpp:15:28: note: in expansion of macro 'rnd'
   15 |                 int c = id[rnd(0, id.size()-1)];
      |                            ^~~
consul.cpp:5:44: error: expected primary-expression before 'int'
    5 | #define rnd(l, r) uniform_int_distribution<int> (l,r)(rng)
      |                                            ^~~
consul.cpp:15:28: note: in expansion of macro 'rnd'
   15 |                 int c = id[rnd(0, id.size()-1)];
      |                            ^~~
consul.cpp:5:44: error: expected ']' before 'int'
    5 | #define rnd(l, r) uniform_int_distribution<int> (l,r)(rng)
      |                                            ^~~
consul.cpp:15:28: note: in expansion of macro 'rnd'
   15 |                 int c = id[rnd(0, id.size()-1)];
      |                            ^~~
consul.cpp:17:17: error: 'mp' was not declared in this scope
   17 |                 mp[cur] ++ ;
      |                 ^~
consul.cpp:26:24: error: expected primary-expression before 'int'
   26 |                 vector<int> ni;
      |                        ^~~
consul.cpp:27:45: error: 'ni' was not declared in this scope; did you mean 'i'?
   27 |                 for(int &i : id) if(i != c) ni.push_back(i);
      |                                             ^~
      |                                             i
consul.cpp:28:22: error: 'ni' was not declared in this scope; did you mean 'n'?
   28 |                 swap(ni, id);
      |                      ^~
      |                      n
consul.cpp:28:17: error: 'swap' was not declared in this scope
   28 |                 swap(ni, id);
      |                 ^~~~