제출 #1151562

#제출 시각아이디문제언어결과실행 시간메모리
1151562gazizmadi11CONSUL (info1cup19_consul)C++20
컴파일 에러
0 ms0 KiB
//gm  --- akezhon
#include <bits/stdc++.h>
#include "grader.h"
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #define pb push_back
// #define pf push_front
#define F first
#define S second
// #define all(v) v.begin(),v.end()
// #define pii pair<int,int>
// #define tm (tl+tr)/2
// #define TL v+v, tl, tm
// #define TR v+v+1, tm+1, tr
// #define DA l <= tl && tr <= r
// #define NE r < tl || tr < l
// #define double long double
// #define int long long
using namespace std;

// const int N=2e5+7;
// const int mod=998244353;
// const int inf=2e18;

void solve(int n){
    vector<int>v;
    for(int i=1; i <= n; i++)v.pb(i);
    random_shuffle(all(v));
    for(int i=0; i < 30; i++){
        int x = kth(v[i]);
        if(cnt(x) > n/3){
            say_answer(x);
            return;
        }
    }
    say_answer(-1);
}

// void AlemAmenov(){

// }
// signed main(){

//     ios_base::sync_with_stdio(0);
//     cin.tie(0);
    // int RealName=1;
    // cin >> RealName;
    // srand(time(0));

//     while(RealName--)
//         // AlemAmenov();
    
// return 0;
// }

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

consul.cpp: In function 'void solve(int)':
consul.cpp:27:32: error: 'class std::vector<int>' has no member named 'pb'
   27 |     for(int i=1; i <= n; i++)v.pb(i);
      |                                ^~
consul.cpp:28:20: error: 'all' was not declared in this scope
   28 |     random_shuffle(all(v));
      |                    ^~~
consul.cpp:28:20: note: suggested alternatives:
In file included from /usr/include/c++/11/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:129,
                 from consul.cpp:2:
/usr/include/c++/11/bits/fs_fwd.h:154:7: note:   'std::filesystem::perms::all'
  154 |       all               =  0777,
      |       ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:146,
                 from consul.cpp:2:
/usr/include/c++/11/ranges:1130:27: note:   'std::ranges::views::all'
 1130 |     inline constexpr _All all;
      |                           ^~~