QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#124218#1834. Eulerian?solemnteeCompile Error//C++171.2kb2023-07-14 13:17:252023-07-14 13:17:27

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-14 13:17:27]
  • 评测
  • [2023-07-14 13:17:25]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
std::mt19937 random(std::chrono::system_clock::now().time_since_epoch().count());//时间随机 

int main(){

    int n;
    cin>>n;
    std::uniform_int_distribution<> u(0,1);//不写默认int范围

    int all=0;

    cout<<"? ";
    cout<<n<<' ';
    for(int i=1;i<=n;i++)cout<<i<<' ';
    cout<<endl;
    cin>>all;

    bool flag=true;
    auto ask=[&](){
        vector<int>v[2];
        for(int i=1;i<=n;i++){
            int rand=u(random);
            v[rand].push_back(i);
        }
        int ans0=0,ans1=0;
        if(v[0].size()!=0){
            cout<<"? ";
            cout<<v[0].size()<<' ';
            for(auto x:v[0])cout<<x<<' ';
            cout<<endl;
            cin>>ans0;
        }
        if(v[1].size()!=0){
            cout<<"? ";
            cout<<v[1].size()<<' ';
            for(auto x:v[1])cout<<x<<' ';
            cout<<endl;
            cin>>ans1;
        }
        int left=all-ans0-ans1;
        if(left&1)flag=false;
    };
    for(int i=1;i<=29;i++)ask();

    if(flag)cout<<"! YES"<<endl;
    else cout<<"! NO"<<endl;
}

Details

answer.code:4:48: error: ‘std::mt19937 random’ redeclared as different kind of entity
    4 | std::mt19937 random(std::chrono::system_clock::now().time_since_epoch().count());//时间随机
      |                                                ^~~
In file included from /usr/include/c++/11/bits/std_abs.h:38,
                 from /usr/include/c++/11/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:1:
/usr/include/stdlib.h:401:17: note: previous declaration ‘long int random()’
  401 | extern long int random (void) __THROW;
      |                 ^~~~~~
In file included from /usr/include/c++/11/bits/stl_algo.h:66,
                 from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from answer.code:1:
/usr/include/c++/11/bits/uniform_int_dist.h: In instantiation of ‘std::uniform_int_distribution<_IntType>::result_type std::uniform_int_distribution<_IntType>::operator()(_UniformRandomBitGenerator&, const std::uniform_int_distribution<_IntType>::param_type&) [with _UniformRandomBitGenerator = long int() noexcept; _IntType = int; std::uniform_int_distribution<_IntType>::result_type = int]’:
/usr/include/c++/11/bits/uniform_int_dist.h:193:34:   required from ‘std::uniform_int_distribution<_IntType>::result_type std::uniform_int_distribution<_IntType>::operator()(_UniformRandomBitGenerator&) [with _UniformRandomBitGenerator = long int() noexcept; _IntType = int; std::uniform_int_distribution<_IntType>::result_type = int]’
answer.code:24:23:   required from here
/usr/include/c++/11/bits/uniform_int_dist.h:280:66: error: ‘long int() noexcept’ is not a class, struct, or union type
  280 |         typedef typename _UniformRandomBitGenerator::result_type _Gresult_type;
      |                                                                  ^~~~~~~~~~~~~
/usr/include/c++/11/bits/uniform_int_dist.h:282:68: error: ‘long int() noexcept’ is not a class, struct, or union type
  282 |         typedef typename common_type<_Gresult_type, __utype>::type __uctype;
      |                                                                    ^~~~~~~~