F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_39304396_7800.cpp: In function 'int main()':
0_0_39304396_7800.cpp:3:240: error: no matching function for call to 'std::__cxx11::list<int>::erase()'
    3 | using namespace std;list<int>a;list<int>::iterator it;int main(){int T,n;cin>>T;while(T--){cin>>n;a.clear();int k=2;for(int i=1;i<=n;i++){a.push_back(i);}while(a.size()>3){int cnt=1;for(it=a.begin();it !=a.end();){if(cnt++%k==0){it=a.erase();}else{it++;}}k=(k==2 ? 3 : 2);}for(it=a.begin();it !=a.end();it++){if(it !=a.begin()){printf(" ");}printf("%d",*it);}printf("\n");}return 0;}
      |                                                                                                                                                                                                                                         ~~~~~~~^~
In file included from gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/list:66,
                 from .\stdc++.h:150:
gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/list.tcc:150:5: note: candidate: 'std::__cxx11::list<_Tp, _Alloc>::iterator std::__cxx11::list<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::__cxx11::list<int>::iterator; const_iterator = std::__cxx11::list<int>::const_iterator]'
  150 |     list<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~
gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/list.tcc:150:5: note:   candidate expects 1 argument, 0 provided
In file included from gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/list:65:
gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_list.h:1550:7: note: candidate: 'std::__cxx11::list<_Tp, _Alloc>::iterator std::__cxx11::list<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::__cxx11::list<int>::iterator; const_iterator = std::__cxx11::list<int>::const_iterator]'
 1550 |       erase(const_iterator __first, const_iterator __last) noexcept
      |       ^~~~~
gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_list.h:1550:7: note:   candidate expects 2 arguments, 0 provided


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-27 10:25:37, Gzip enabled