제출 #1119615

#제출 시각아이디문제언어결과실행 시간메모리
1119615thangdz2k7CONSUL (info1cup19_consul)C++17
컴파일 에러
0 ms0 KiB
// author : thembululquaUwU // 3.9.2024 #include <bits/stdc++.h> #include "grader.h" #define pb push_back #define fi first #define se second #define endl '\n' using namespace std; using ll = long long; using ii = pair <int, int>; using vi = vector <int>; const int N = 1e6; const int mod = 1e9 + 7; void maxl(auto &a, auto b) {a = max(a, b);} void minl(auto &a, auto b) {a = min(a, b);} mt19937_64 rd(chrono::steady_clock::now().time_since_epoch().count()); #define rand rd void solve(int n){ srand(time(NULL)); vector <int> ap; for (int loops = 1; loops < min(60, n); ++ loops){ int i = rd() % n + 1; int v = kth(i); ap.push_back(v); } sort(ap.begin(), ap.end()); int can = 0, cnt = 0, mx = 0; for (int i = 0; i < ap.size(); ++ i){ cnt ++; if (i + 1 == ap.size() || ap[i] != ap[i + 1]){ if (cnt > mx){ mx = cnt; can = ap[i]; } cnt = 0; } } if (cnt(can) * 3 >= n){ say_answer(can); } else say_answer(-1); } //int main(){ // if (fopen("pqh.inp", "r")){ // freopen("pqh.inp", "r", stdin); // freopen("pqh.out", "w", stdout); // } // ios_base::sync_with_stdio(0); // cin.tie(0); cout.tie(0); // // int t = 1; // cin >> t; // while (t --) solve(); // return 0; //}

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

consul.cpp:19:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void maxl(auto &a, auto b) {a = max(a, b);}
      |           ^~~~
consul.cpp:19:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void maxl(auto &a, auto b) {a = max(a, b);}
      |                    ^~~~
consul.cpp:20:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   20 | void minl(auto &a, auto b) {a = min(a, b);}
      |           ^~~~
consul.cpp:20:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   20 | void minl(auto &a, auto b) {a = min(a, b);}
      |                    ^~~~
consul.cpp: In function 'void solve(int)':
consul.cpp:38:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for (int i = 0; i < ap.size(); ++ i){
      |                     ~~^~~~~~~~~~~
consul.cpp:40:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         if (i + 1 == ap.size() || ap[i] != ap[i + 1]){
      |             ~~~~~~^~~~~~~~~~~~
consul.cpp:49:16: error: 'cnt' cannot be used as a function
   49 |     if (cnt(can) * 3 >= n){
      |                ^