submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s066245252
p03673
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main(){ int n; cin>>n; string b; if(n==1){ int a; cin>>a; cout<<a; return 0; } rep(i,n){ string a; cin>>a; b+=a; reverse(b.begin(),b.end()); } rep(i,n){ cout<<b[i]<<" "; }
a.cc: In function 'int main()': a.cc:21:4: error: expected '}' at end of input 21 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s273760603
p03673
Java
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n = Integer.parseInt(scan.next()); List<int> b = new ArrayList<int>(); int a for(int i = 0; i < n; i++){ a = Integer.parseInt(scan.next()); if(a % 2 == 0){ list.add(a); }else{ list.add(0, a); } } if(n % 2 == 0){ for(int i = 0; i<n; i++){ System.out.println(b.get(i)); } }else{ for(int i = 0; i < n; i ++){ System.out.println(b.get(n - i - 1)); } } } }
Main.java:7: error: ';' expected int a ^ 1 error
s491062004
p03673
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++) #define VL vector<ll> #define INF 100000000 typedef long long ll; int main() { int n; cin>>n; vector<int>q; for(int i=0;i<n;i++){ int a; cin>>a; if(i%2==0){ q.push_back(a); }else{ q.push_front(a); } } if(n%2==1)reverse(q.begin(),q.end()); for(int i=0;i<n;i++){ if(i==n-1)cout<<q[i]<<endl; else cout<<q[i]<<" "; } return 0; }
a.cc: In function 'int main()': a.cc:18:9: error: 'class std::vector<int>' has no member named 'push_front' 18 | q.push_front(a); | ^~~~~~~~~~
s167700650
p03673
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> b; for(int i=0;i<n;i++){ char a; cin >> a; if(i%2) b.push_back(a); else b.pop_back(a); } if(n%2) reverse(b.begin(),b,end()); for(int i=0;i<n-1;i++) cout << b.at(i) << " "; cout << b.at(n-1) << endl; }
a.cc: In function 'int main()': a.cc:12:20: error: no matching function for call to 'std::vector<int>::pop_back(char&)' 12 | else b.pop_back(a); | ~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1324:7: note: candidate: 'void std::vector<_Tp, _Alloc>::pop_back() [with _Tp = int; _Alloc = std::allocator<int>]' 1324 | pop_back() _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1324:7: note: candidate expects 0 arguments, 1 provided a.cc:14:34: error: no matching function for call to 'end()' 14 | if(n%2) reverse(b.begin(),b,end()); | ~~~^~ In file included from /usr/include/c++/14/bits/algorithmfwd.h:39, from /usr/include/c++/14/bits/stl_algo.h:59, from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ /usr/include/c++/14/initializer_list:99:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidate expects 1 argument, 0 provided
s624748545
p03673
C
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++) #define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++) #define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--) #define rreps(i,n) for(int i=((int)(n));i>0;i--) #define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++) #define all(x) (x).begin(), (x).end() #define F first #define S second #define mp make_pair #define pb push_back #define solve(a) ((a)?"Yes":"No") typedef vector<int> Vi; typedef vector<Vi> VVi; typedef pair<int , int> Pi; typedef vector<Pi> VPi; typedef vector<long long> V; typedef vector<V> VV; typedef pair<long long , long long> P; typedef vector<P> VP; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;} template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;} const long long INFLL = 1LL<<60; const int INF = 1<<30; const double PI=acos(-1); int main(){ int n; int ans=0; cin >>n; int a; deque<int>data; rep(i,n){ cin>>a; if(i%2==0){ data.push_back(a); }else{ data.push_front(a); } } while(!data.empty()){ if(n%2==0){ a=data.front(); data.pop_front(); }else{ a=data.back(); data.pop_back(); } cout<<a; if(data.empty()){ cout<<endl; }else{ cout<<" "; } } }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s962381623
p03673
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i = (a); i < (b); ++i) #define all(x) begin(x), end(x) typedef long long ll; typedef pair<int, int> pii; const int inf=1010001000; const ll INF=1001000100010001000; const int mod=(int)1e9+7; int main(){ int n; cin>>n; vector<int>a(n); deque<int> b; rep(i,0,n){ cin>>a.at(i); } rep(i,0,n){ if(i%2==0)b.push_front; else b.push_back(a.at(i)); } if(n%2==0)reverse(all(b)); rep(i,0,n){ cout<<b.at(i)<<' '; } return 0; }
a.cc: In function 'int main()': a.cc:21:21: error: statement cannot resolve address of overloaded function 21 | if(i%2==0)b.push_front; | ~~^~~~~~~~~~
s522918662
p03673
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long N; cin>>N; list<long long>A; for(int i=0;i<N;i++){ long long a; cin>>a; if(i%2==0){ A.push_back(a); } else{ A.push_front(a); } } if(N%2==1){ reverse(A.begin(),A.end()); } for_each(A.cbegin(), A.cend(), [](long long x){ cout << x << " "; }) }
a.cc: In function 'int main()': a.cc:22:5: error: expected ';' before '}' token 22 | }) | ^ | ; 23 | } | ~
s392741209
p03673
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long N; cin>>N; list<long long>A; for(int i=0;i<N;i++){ long long a; cin>>a; if(i%2==0){ A.push_back(a); } else{ A.push_front(a); } } if(N%2==1){ reverse(A.begin(),A.end()); } for_each(ls.cbegin(), ls.cend(), [](long long x){ cout << x << " "; }) }
a.cc: In function 'int main()': a.cc:20:12: error: 'ls' was not declared in this scope 20 | for_each(ls.cbegin(), ls.cend(), [](long long x){ | ^~
s853226683
p03673
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long N; cin>>N; list<long long>A; for(int i=0;i<N;i++){ long long a; cin>>a; if(i%2==0){ A.push_back(a); } else{ A.push_front(a); } } if(N%2==1){ reverse(A.begin(),A.end()); } for(int i=0;i<N;i++){ cout<<A[i]<<" "; } }
a.cc: In function 'int main()': a.cc:21:12: error: no match for 'operator[]' (operand types are 'std::__cxx11::list<long long int>' and 'int') 21 | cout<<A[i]<<" "; | ^
s036725612
p03673
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long N; cin>>N; list<long long>A; for(int i=0;i<N;i++){ long long a; cin>>a; if(i%2==0){ A.push_back(a); } else{ A.push_front(a); } } if(N%2==1){ reverse(A.begin(),A.end()); } for(int i=0;i<N;i++){ cout<<A.at(i)<<" "; } }
a.cc: In function 'int main()': a.cc:21:13: error: 'class std::__cxx11::list<long long int>' has no member named 'at' 21 | cout<<A.at(i)<<" "; | ^~
s286018395
p03673
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long N; cin>>N; vector<long long>A; for(int i=0;i<N;i++){ long long a; cin>>a; if(i%2==0){ A.push_back(a); } else{ auto it; it = A.begin(); it = A.insert(it,a); } } if(N%2==1){ reverse(A.begin(),A.end()); } for(int i=0;i<N;i++){ cout<<A.at(i)<<" "; } }
a.cc: In function 'int main()': a.cc:14:7: error: declaration of 'auto it' has no initializer 14 | auto it; | ^~~~
s930386709
p03673
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long N; cin>>N; vector<long long>A; for(int i=0;i<N;i++){ long long a; cin>>a; if(i%2==0){ A.push_back(a); } else{ it = A.begin(); it = A.insert(it,a); } } if(N%2==1){ reverse(A.begin(),A.end()); } for(int i=0;i<N;i++){ cout<<A.at(i)<<" "; } }
a.cc: In function 'int main()': a.cc:14:7: error: 'it' was not declared in this scope; did you mean 'i'? 14 | it = A.begin(); | ^~ | i
s034768242
p03673
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long N; cin>>N; vector<long long>A; for(int i=0;i<N;i++){ long long a; cin>>a; if(i%2==0){ A.push_back(a); } else{ A.push_front(a); } } if(N%2==1){ reverse(A.begin(),A.end()); } for(int i=0;i<N;i++){ cout<<A,at(i)<<" "; } }
a.cc: In function 'int main()': a.cc:14:9: error: 'class std::vector<long long int>' has no member named 'push_front' 14 | A.push_front(a); | ^~~~~~~~~~ a.cc:21:9: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<long long int>') 21 | cout<<A,at(i)<<" "; | ~~~~^~~ | | | | | std::vector<long long int> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __
s792289987
p03673
C++
#define rep(i, n) for(int i=0; i<n; ++i) using namespace std; using ll = int64_t; using vi = vector<int>; using vvi = vector<vi>; int main() { int n; cin >> n; vi a(n); rep(i, n) { cin >> a[i]; } vi b; rep(i, n) { if(i+1 <= (n+1)/2) { b.push_back(a[n-2*i-1]); } else { b.push_back(a[n-2*(n-i)]); } } rep(i, n-1) { cout << b[i] << ' '; } cout << b[n-1] << '\n'; }
a.cc:3:12: error: 'int64_t' does not name a type 3 | using ll = int64_t; | ^~~~~~~ a.cc:1:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' +++ |+#include <cstdint> 1 | #define rep(i, n) for(int i=0; i<n; ++i) a.cc:4:12: error: 'vector' does not name a type 4 | using vi = vector<int>; | ^~~~~~ a.cc:5:13: error: 'vector' does not name a type 5 | using vvi = vector<vi>; | ^~~~~~ a.cc: In function 'int main()': a.cc:10:5: error: 'cin' was not declared in this scope 10 | cin >> n; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #define rep(i, n) for(int i=0; i<n; ++i) a.cc:11:5: error: 'vi' was not declared in this scope 11 | vi a(n); | ^~ a.cc:13:16: error: 'a' was not declared in this scope 13 | cin >> a[i]; | ^ a.cc:16:7: error: expected ';' before 'b' 16 | vi b; | ^~ | ; a.cc:19:13: error: 'b' was not declared in this scope 19 | b.push_back(a[n-2*i-1]); | ^ a.cc:19:25: error: 'a' was not declared in this scope 19 | b.push_back(a[n-2*i-1]); | ^ a.cc:21:13: error: 'b' was not declared in this scope 21 | b.push_back(a[n-2*(n-i)]); | ^ a.cc:21:25: error: 'a' was not declared in this scope 21 | b.push_back(a[n-2*(n-i)]); | ^ a.cc:26:9: error: 'cout' was not declared in this scope 26 | cout << b[i] << ' '; | ^~~~ a.cc:26:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:26:17: error: 'b' was not declared in this scope 26 | cout << b[i] << ' '; | ^ a.cc:28:5: error: 'cout' was not declared in this scope 28 | cout << b[n-1] << '\n'; | ^~~~ a.cc:28:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:28:13: error: 'b' was not declared in this scope 28 | cout << b[n-1] << '\n'; | ^
s803057806
p03673
C++
#define rep(i, n) for(int i=0; i<n; ++i) using namespace std; using ll = int64_t; using vi = vector<int>; using vvi = vector<vi>; int main() { int n; cin >> n; vi a(n); rep(i, n) { cin >> a[i]; } vi b; rep(i, n) { if(i+1 <= (n+1)/2) { b.push_back(a[n-2*i-1]); } else { b.push_back(a[n-2*(n-i)]); } } rep(i, n-1) { cout << b[i] << ' '; } cout << b[n-1] << '\n'; }
a.cc:3:12: error: 'int64_t' does not name a type 3 | using ll = int64_t; | ^~~~~~~ a.cc:1:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' +++ |+#include <cstdint> 1 | #define rep(i, n) for(int i=0; i<n; ++i) a.cc:4:12: error: 'vector' does not name a type 4 | using vi = vector<int>; | ^~~~~~ a.cc:5:13: error: 'vector' does not name a type 5 | using vvi = vector<vi>; | ^~~~~~ a.cc: In function 'int main()': a.cc:10:5: error: 'cin' was not declared in this scope 10 | cin >> n; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #define rep(i, n) for(int i=0; i<n; ++i) a.cc:11:5: error: 'vi' was not declared in this scope 11 | vi a(n); | ^~ a.cc:13:16: error: 'a' was not declared in this scope 13 | cin >> a[i]; | ^ a.cc:16:7: error: expected ';' before 'b' 16 | vi b; | ^~ | ; a.cc:19:13: error: 'b' was not declared in this scope 19 | b.push_back(a[n-2*i-1]); | ^ a.cc:19:25: error: 'a' was not declared in this scope 19 | b.push_back(a[n-2*i-1]); | ^ a.cc:21:13: error: 'b' was not declared in this scope 21 | b.push_back(a[n-2*(n-i)]); | ^ a.cc:21:25: error: 'a' was not declared in this scope 21 | b.push_back(a[n-2*(n-i)]); | ^ a.cc:26:9: error: 'cout' was not declared in this scope 26 | cout << b[i] << ' '; | ^~~~ a.cc:26:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:26:17: error: 'b' was not declared in this scope 26 | cout << b[i] << ' '; | ^ a.cc:28:5: error: 'cout' was not declared in this scope 28 | cout << b[n-1] << '\n'; | ^~~~ a.cc:28:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:28:13: error: 'b' was not declared in this scope 28 | cout << b[n-1] << '\n'; | ^
s952893343
p03673
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int a[n]; for(int i=0;i<n;i++){ cin >> a[i]; } if(i%2==0){ for(int i=n-1;i>0;i=i-2){ cout << a[i] << ' '; } for(int i=0;i<n;i=i+2){ cout << a[i] << ' '; } } else{ for(int i=n-1;i>0;i=i-2){ cout << a[i] << ' '; } for(int i=1;i<n;i=i+2){ cout << a[i] << ' '; } } }
a.cc: In function 'int main()': a.cc:10:6: error: 'i' was not declared in this scope 10 | if(i%2==0){ | ^
s615518833
p03673
C++
#include <bits/stdc++.h> #include<chrono> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) int main() { int n; cin >> n; deque<ll> A; if (n % 2 == 0) { rep(i, n/2) { ll a1, a2; cin >> a1 >> a2; A.push_back(a1); A.pop_front(a2); } } else { ll a; cin >> a; A.push_front(a); rep(i, (n-1)/2) { ll a2, a3; cin >> a2 >> a3; A.push_back(a2); A.push_front(a3); } } rep(i, n) { if (i == n-1) { cout << A[i] << endl; return 0; } cout << A[i] << " "; } }
a.cc: In function 'int main()': a.cc:17:24: error: no matching function for call to 'std::deque<long long int>::pop_front(ll&)' 17 | A.pop_front(a2); | ~~~~~~~~~~~^~~~ In file included from /usr/include/c++/14/deque:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:139, from a.cc:1: /usr/include/c++/14/bits/stl_deque.h:1574:7: note: candidate: 'void std::deque<_Tp, _Alloc>::pop_front() [with _Tp = long long int; _Alloc = std::allocator<long long int>]' 1574 | pop_front() _GLIBCXX_NOEXCEPT | ^~~~~~~~~ /usr/include/c++/14/bits/stl_deque.h:1574:7: note: candidate expects 0 arguments, 1 provided
s948818228
p03673
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<long long> a; vector<long long> b; for (int i=1;i<=n;++i){ int n; cin >> n; b.push_back(a); sort(b.begin(),b.end()); cout << b[i] << endl; } }
a.cc: In function 'int main()': a.cc:13:16: error: no matching function for call to 'std::vector<long long int>::push_back(std::vector<long long int>&)' 13 | b.push_back(a); | ~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<long long int>::value_type&' {aka 'const long long int&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<long long int>::value_type&&' {aka 'long long int&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~
s800242581
p03673
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<long long> a(n); for (int i=1;i<=n;++i) cin >> a[i]; vector<long long> b(n); for (int i=1;i<=n;++i){ b.push_back(a); sort(b.begin(),b.end()); cout << b[i] << endl; } }
a.cc: In function 'int main()': a.cc:12:16: error: no matching function for call to 'std::vector<long long int>::push_back(std::vector<long long int>&)' 12 | b.push_back(a); | ~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<long long int>::value_type&' {aka 'const long long int&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<long long int>::value_type&&' {aka 'long long int&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~
s434563045
p03673
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i < n; ++i) using namespace std; int main(){ int n; scanf("%d", &n); deque<int> d; rep(i, n){ int a; scanf("%d", &a); if(i & 1) d.push_front(a); else d.push_back(a); } if(n & 1){ rep(i, n){ printf("%d", d.front()); d.pop_front(); if(i < n-1) printf(" "); } } else{ rep(i, n){ printf("%d", d.back()); d.pop_back(); if(i < n-1) printf(" "); } } printf("\n") return 0; }
a.cc: In function 'int main()': a.cc:27:15: error: expected ';' before 'return' 27 | printf("\n") | ^ | ; 28 | return 0; | ~~~~~~
s997449705
p03673
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; vector<int>A(N); for(int i=0;i<N;i++) cin>>A.at(i); vector<int>B(N); for(int i=0;i<N){ if(i<=(N-1)/2){ B.at(i)=A.at(N-1-2*i); }else{ B.at(i)=A.at((N%2)+2*(i-(N+1)/2)); } }for(int i=0;i<N;i++) cout<<B.at(i)<<" "; cout<<B.at(N-1)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:18: error: expected ';' before ')' token 10 | for(int i=0;i<N){ | ^ | ;
s582796994
p03673
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll n,a; cin >> n; ll i; for(i=0;i<n;i++){ cin >> a[i]; } for(i=0;i<=n/2;i++){ cout << a[n-1-2*i] << " "; } for(i=0;i<n/2;i++){ cout << a[n%2+2*i] << " "; } return 0; }
a.cc: In function 'int main()': a.cc:19:17: error: invalid types 'long long int[long long int]' for array subscript 19 | cin >> a[i]; | ^ a.cc:22:18: error: invalid types 'long long int[long long int]' for array subscript 22 | cout << a[n-1-2*i] << " "; | ^ a.cc:25:18: error: invalid types 'long long int[long long int]' for array subscript 25 | cout << a[n%2+2*i] << " "; | ^
s196015634
p03673
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll n,a; ll i; for(i=0;i<n;i++){ cin >> a[i]; } for(i=0;i<=n/2;i++){ cout << a[n-1-2*i]; } for(i=0;i<n/2;i++){ cout << a[n%2+2*i]; } return 0; }
a.cc: In function 'int main()': a.cc:18:17: error: invalid types 'long long int[long long int]' for array subscript 18 | cin >> a[i]; | ^ a.cc:21:18: error: invalid types 'long long int[long long int]' for array subscript 21 | cout << a[n-1-2*i]; | ^ a.cc:24:18: error: invalid types 'long long int[long long int]' for array subscript 24 | cout << a[n%2+2*i]; | ^
s987035746
p03673
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll n,a; for(i=0;i<n;i++){ cin >> a[i]; } for(i=0;i<=n/2;i++){ cout << a[n-1-2*i]; } for(i=0;i<n/2;i++){ cout << a[n%2+2*i]; } return 0; }
a.cc: In function 'int main()': a.cc:16:9: error: 'i' was not declared in this scope 16 | for(i=0;i<n;i++){ | ^ a.cc:19:9: error: 'i' was not declared in this scope 19 | for(i=0;i<=n/2;i++){ | ^ a.cc:22:9: error: 'i' was not declared in this scope 22 | for(i=0;i<n/2;i++){ | ^
s582223450
p03673
C++
import numpy as np n = int(input()) a = [int(i) for i in input().split()] begin = a[0::2] end =a[1::0] if n%2 == 0: end = end[:-1] ans = np.concatenate(end,begin) else: begin = begin[::-1] ans = np.concatenate(begin,end) print(ans)
a.cc:1:1: error: 'import' does not name a type 1 | import numpy as np | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s510508835
p03673
C++
#include <bits/stdc++.h> #define rep(i, n) for(long long i = 0; i < n; i++) using namespace std; signed main(void) { long long n; cin >> n; long long a[n]; deque<long long> dq; bool ok; rep(i, n) cin >> a[i]; ok = false; rep(i, n) { ok ^= 1; if (i % 2 == 0) dq.push_back(a[i]); else dq.push_front(a[i]); } if (ok) reverse(dq.begin(), dq.end()); while(!dq.empty()) { prlong longf("%d ", dq.front()); dq.pop_front(); } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:27:17: error: 'prlong' was not declared in this scope; did you mean 'ulong'? 27 | prlong longf("%d ", dq.front()); | ^~~~~~ | ulong
s651618602
p03673
C++
#include<bits/stdc++.h> #define rep(i,n)for(int i=0;i<n;++i) #include<string> #include<vector> using namespace std; typedef long long ll; typedef pair<int, int>P; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } //max=({}); //条件式が真ならwhileの中身を回し続ける //printf("%d\n", ans); //pairの入力 //vector<pair<ll, ll>>work(n); //rep(i, n) { // ll a, b; // cin >> a >> b; // work[i] = make_pair(a, b); //for(auto p:mp)(mapの探索) //printf("%.10f\n",なんちゃら) int g[15][15]; const int INF = 1001001001; const int dx[4] = { -1,0,1,0 }; const int dy[4] = { 0,-1,0,1 }; //最大公約数 ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; } ll lcm(ll x, ll y) { if (x == 0 || y == 0)return 0; return (x / gcd(x, y) * y); } //素因数分解 vector<pair<ll, int>>factorize(ll n) { vector<pair<ll, int>>res; for (ll i = 2;i * i <= n;++i) { if (n % i)continue; res.emplace_back(i, 0); while (n % i == 0) { n /= i; res.back().second++; } } if (n != 1)res.emplace_back(n, 1); return res; } int bingo[3][3]; bool flag[3][3]; int cnt[2][105]; int h, w; int choco[1010][1010]; int s[11][11]; int main() { int n; cin >> n; vector<int>a(n); deque<int>deq; rep(i, n) { cin >> a[i]; } rep(i, n) { if (i % 2 == 0)deq.push_back(a[i]); else deq.push_front(a[i]); } if (n % 2 != 0) { for (i = n - 1;i >= 0;--i) { cout << deq[i] << endl; } } else { rep(i, n) { cout << deq[i] << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:73:22: error: 'i' was not declared in this scope 73 | for (i = n - 1;i >= 0;--i) { | ^
s200930272
p03673
C++
#include<iostream> #include<algorithm> #include<string> #include<vector> #include<stack> #include<queue> #include<map> #include<set> #include<cmath> #define ll long long #define rep(i,a,n) for(int i=(a);i<(n);i++) using namespace std; int main() { int n; cin >> n; vector<int> a(n),ans; rep(i, 1,n+1) { cin >> a[i-1]; if ((n - i) % 2 == 1) ans.emplace_back(0,a[i-1]); else ans.push_back(a[i - 1]); } rep(i, 0, n) { cout << ans[i] << endl; } return 0; }
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33, from /usr/include/c++/14/bits/allocator.h:46, from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = int; _Args = {int, int&}; _Tp = int]': /usr/include/c++/14/bits/alloc_traits.h:575:17: required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = int; _Args = {int, int&}; _Tp = int; allocator_type = std::allocator<int>]' 575 | __a.construct(__p, std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:117:30: required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int, int&}; _Tp = int; _Alloc = std::allocator<int>; reference = int&]' 117 | _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:21:41: required from here 21 | if ((n - i) % 2 == 1) ans.emplace_back(0,a[i-1]); | ~~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/new_allocator.h:191:11: error: new initializer expression list treated as compound expression [-fpermissive] 191 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s392392573
p03673
C++
#include<cstdio> using namespce std;int n,a[200010];inline int read(){ register int ret=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();return ret;}int main(){n=read();for(register int i=1;i<=n;++i)a[i]=read();for(register int i=n;i>0;i-=2)printf("%d ",a[i]);for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);return 0;}
a.cc:2:7: error: expected nested-name-specifier before 'namespce' 2 | using namespce std;int n,a[200010];inline int read(){ register int ret=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();return ret;}int main(){n=read();for(register int i=1;i<=n;++i)a[i]=read();for(register int i=n;i>0;i-=2)printf("%d ",a[i]);for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);return 0;} | ^~~~~~~~ a.cc: In function 'int read()': a.cc:2:68: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 2 | using namespce std;int n,a[200010];inline int read(){ register int ret=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();return ret;}int main(){n=read();for(register int i=1;i<=n;++i)a[i]=read();for(register int i=n;i>0;i-=2)printf("%d ",a[i]);for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);return 0;} | ^~~ a.cc: In function 'int main()': a.cc:2:233: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 2 | using namespce std;int n,a[200010];inline int read(){ register int ret=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();return ret;}int main(){n=read();for(register int i=1;i<=n;++i)a[i]=read();for(register int i=n;i>0;i-=2)printf("%d ",a[i]);for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);return 0;} | ^ a.cc:2:275: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 2 | using namespce std;int n,a[200010];inline int read(){ register int ret=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();return ret;}int main(){n=read();for(register int i=1;i<=n;++i)a[i]=read();for(register int i=n;i>0;i-=2)printf("%d ",a[i]);for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);return 0;} | ^ a.cc:2:324: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 2 | using namespce std;int n,a[200010];inline int read(){ register int ret=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();return ret;}int main(){n=read();for(register int i=1;i<=n;++i)a[i]=read();for(register int i=n;i>0;i-=2)printf("%d ",a[i]);for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);return 0;} | ^
s258787096
p03673
C++
#include<iostream> using namespace std; #include<string> #include<vector> int main(){ string s=""; int n; cin>>n; vector<int> a(n); for(int i=0;i<n;i++){ cin>>a[i]; if((n-i)/2==1)s=s+a[i]+'0'; else s+=a[i]+'0'; } cout<<s<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:22: error: no match for 'operator+' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 12 | if((n-i)/2==1)s=s+a[i]+'0'; In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ In file included from /usr/include/c++/14/string:54: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'const _CharT*' and 'int' 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:12:26: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:12:26: note: mismatched types 'const _CharT*' and 'int' 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:12:26: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 12 | if((n-i)/2==1)s=s+a[i]+'0'; | ^
s154884602
p03673
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin >> n; vector<ll> vec1; vector<ll> vec2; for (ll i = 0;i<n;i++) { ll a; cin >> a; if (i%2==0) { vec1.push_back(a); } else vec2.push_back(a); } reverse(vec2.begin(),vec2.end()); for (ll i = 0;i<vec2.size();i++) cout << vec2.at(i) << " "; for (ll i = 0;i<vec1.size();i++) cout << vec1.at(i) << " "; } }
a.cc:22:1: error: expected declaration before '}' token 22 | } | ^
s231639970
p03673
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for(ll i = 0; i < (ll)(n); i++) #define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++) #define memi cout << endl #define kono(n) cout << fixed << setprecision(n) #define all(c) (c).begin(), (c).end() #define pb push_back #define hina cout << ' ' #define in(n) cin >> n #define in2(n, m) cin >> n >> m #define in3(n, m, l) cin >> n >> m >> l #define out(n) cout << n const ll mei = (ll)1e9 + 7; int main(){ ll n; in(n); vector<ll> a(n), c, d; rep(i, n) in(a[i]); rep(i, n){ if(i % 2 == 0) c.pb(a[i]); else d.pb(a[i]); } if(n % 2 == 0){ rep(i, c.size()){ out(c[c.size - 1 - i]); hina; } rep(i, d.size()){ out(d[i]); hina; } } else{ rep(i, d.size()){ out(d[d.size() - 1 - i]); hina; } rep(i, c.size()){ out(c[i]); hina; } } memi; }
a.cc: In function 'int main()': a.cc:31:15: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = long long int; _Alloc = std::allocator<long long int>; size_type = long unsigned int]' (did you forget the '()' ?) 31 | out(c[c.size - 1 - i]); | ~~^~~~ a.cc:14:24: note: in definition of macro 'out' 14 | #define out(n) cout << n | ^
s584073701
p03673
C++
#include<bits/stdc++.h> using namespace std; long long a[200003],l,r,n,g; int main(){ cin>>n; l=n/2-1,r=n/2+1,g=?; cin>>a[n/2]; for(int i=1;i<n;i++){ if(g==0) cin>>a[l],l--; else cin>>a[r],r++; g=!g;} for(int i=0;i<n;i++) cout<<a[i]<<" ";}
a.cc: In function 'int main()': a.cc:6:19: error: expected primary-expression before '?' token 6 | l=n/2-1,r=n/2+1,g=?; | ^ a.cc:6:20: error: expected primary-expression before ';' token 6 | l=n/2-1,r=n/2+1,g=?; | ^ a.cc:6:20: error: expected ':' before ';' token 6 | l=n/2-1,r=n/2+1,g=?; | ^ | : a.cc:6:20: error: expected primary-expression before ';' token
s423971994
p03673
C++
#include <bits/stdc++.h> #define rep(i, n) for (ll i=0;i<(n); i++) using namespace std; typedef long long ll; typedef pair<ll, ll> pi; //vector<vector<ll> > comb(ll n, ll b){ void comb(vector<vector <ll> > &v, ll n){ cout << v.size(); rep(i, n){ v[i][0] = 1; v[i][i] = 1; } rep(j, n) { rep(k,j) { v[j][k] = (v[j-1][k-1] + v[j-1][k]); } } } int main(){ ll n; cin >> n; ll ans; vector<ll> v(n); if (n==1) { cin >> ans; cout << ans << endl; return 0; } if (n%2==0){ rep(i,n) { if (i%2==0) cin >> v.at(i/2+n/2-1); else cin >> v.at(-i/2+n/2); } else { rep(i,n){ if (i==1) cin >> v.at(n/2); else if (i%2==0) cin >> v.at(i/2+n/2+1); else cin >> v.at(-i/2+n/2-1); } } rep(i,n) cout << v.at(i) << " "; cout << endl; } }
a.cc: In function 'int main()': a.cc:43:3: error: expected '}' before 'else' 43 | else { | ^~~~ a.cc:38:14: note: to match this '{' 38 | if (n%2==0){ | ^ a.cc: At global scope: a.cc:54:1: error: expected declaration before '}' token 54 | } | ^
s960059966
p03673
C++
#pragma GCC optimize("Ofast") #include<bits/stdc++.h> using namespace std; using ll=long long; using ld=long double; const ll LL_MAX=LLONG_MAX; struct In{ template<typename T> operator T(){ T x; cin >> x; return x; } }; template <typename T,typename U> void forin(T* x,U n){ for (U i=0;i<n;i++) cin >> x[i]; } template <typename T> int div1(T x) { return x%1000000007; } template <typename T> void out(T x){ cout << x << endl; } int main(){ In in; int n=in,a[n]; forin(a,n); deque<int> ans; bool m=true; for (int i=0;i<n;i++){ if (m){ ans.push_back(a[i]); m=false; } else{ ans.push_front(a[i]); m=true; } } if (i%2!=0) reverse(ans.begin(),ans.end()); for (int i=0;i<n;i++){ cout << ans[i] << ' '; } cout << endl; }
a.cc: In function 'int main()': a.cc:47:9: error: 'i' was not declared in this scope 47 | if (i%2!=0) reverse(ans.begin(),ans.end()); | ^
s930115567
p03673
C++
#include <iostream> #include <deque> using namespace std; #define pb push_back #define pf push_front int n, t; deque<int> b; bool rev; int main(void) { cin >> n; for (int i = 0; i < n; i++) { cin >> t; if (!rev) { b.pb(t); rev = true; } else { b.pf(t); rev = false; } } if (!rev) { for (int i = 0; i < b.size(); i++) cout << b[i] << " "; cout << "\n"; } else { for (int i = b.size() - 1; i <= 0; i--) cout << b[i] << " "; cout << "\n"; } } }
a.cc:35:1: error: expected declaration before '}' token 35 | } | ^
s540384640
p03673
C++
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(),x.end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;} template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;} typedef long long ll; int n,m,k; string s,t; int main() { cin >> n; int a[201010]; rep(i,n) cin >> a[i]; deque<int> b; rep(i,n){ if(i%2==0) b.push_back(a[i]); else b.push_front(a[i]); } rep(i,n){ int x; if(n%2==0) x=b.front(),b,pop_front(); else x=b.back(),b.pop_back(); cout << x << " "; } cout << endl; }
a.cc: In function 'int main()': a.cc:23:30: error: 'pop_front' was not declared in this scope 23 | if(n%2==0) x=b.front(),b,pop_front(); | ^~~~~~~~~
s101802854
p03673
C++
#include <iostream> #include<vector> using namespace std; #define int long long int #include<deque> #include<algorithm> //Compiler version g++ 6.3.0 deque<int> d; signed main() { int n,t;cin>>n; for(int i=1;i<=n;i++){ cin>>t; if(i&1){ d.push_back(t); } else { d.push_front(t); } } vector<int> v; for(auto x: d){ v.push_back(x); } if((n&1)){ reverse(v.begin(),v.end()); } for(auto x:v){ cout<<x<<" "; } }
/usr/include/c++/14/bits/uniform_int_dist.h: In member function 'std::uniform_int_distribution<_IntType>::result_type std::uniform_int_distribution<_IntType>::operator()(_UniformRandomBitGenerator&, const param_type&)': a.cc:4:18: error: 'long long long' is too long for GCC 4 | #define int long long int | ^~~~ a.cc:4:18: error: 'long long long' is too long for GCC 4 | #define int long long int | ^~~~ /usr/include/c++/14/bits/stl_algo.h: In function 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare)': a.cc:4:13: error: expected primary-expression before 'long' 4 | #define int long long int | ^~~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:6: /usr/include/c++/14/bits/stl_algo.h:1815:29: error: expected ')' before 'long' 1815 | if (__last - __first > int(_S_threshold)) | ~ ^ | ) a.cc:4:13: error: expected primary-expression before 'long' 4 | #define int long long int | ^~~~ /usr/include/c++/14/bits/stl_algo.h:1817:51: error: expected ')' before 'long' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~ ^ | ) a.cc:4:13: error: expected primary-expression before 'long' 4 | #define int long long int | ^~~~ /usr/include/c++/14/bits/stl_algo.h:1818:52: error: expected ')' before 'long' 1818 | std::__unguarded_insertion_sort(__first + int(_S_threshold), __last, | ~ ^ | ) /usr/include/c++/14/bits/stl_algo.h: In function 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare)': a.cc:4:13: error: expected primary-expression before 'long' 4 | #define int long long int | ^~~~ /usr/include/c++/14/bits/stl_algo.h:1880:32: error: expected ')' before 'long' 1880 | while (__last - __first > int(_S_threshold)) | ~ ^ | ) a.cc:4:13: error: expected primary-expression before 'long' 4 | #define int long long int | ^~~~ In file included from /usr/include/c++/14/deque:66, from a.cc:5: /usr/include/c++/14/bits/stl_deque.h: In instantiation of 'struct std::_Deque_iterator<long long int, long long int&, long long int*>': /usr/include/c++/14/bits/stl_deque.h:507:47: required from 'class std::_Deque_base<long long int, std::allocator<long long int> >' 507 | typedef typename iterator::_Map_pointer _Map_pointer; | ^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_deque.h:788:11: required from 'class std::deque<long long int>' 788 | class deque : protected _Deque_base<_Tp, _Alloc> | ^~~~~ a.cc:9:12: required from here 9 | deque<int> d; | ^ /usr/include/c++/14/bits/stl_deque.h:202:7: error: postfix 'std::_Deque_iterator<_Tp, _Ref, _Ptr>::_Self std::_Deque_iterator<_Tp, _Ref, _Ptr>::operator++(long long int) [with _Tp = long long int; _Ref = long long int&; _Ptr = long long int*; _Self = std::_Deque_iterator<long long int, long long int&, long long int*>::_Self]' must have 'int' as its argument 202 | operator++(int) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/bits/stl_deque.h:222:7: error: postfix 'std::_Deque_iterator<_Tp, _Ref, _Ptr>::_Self std::_Deque_iterator<_Tp, _Ref, _Ptr>::operator--(long long int) [with _Tp = long long int; _Ref = long long int&; _Ptr = long long int*; _Self = std::_Deque_iterator<long long int, long long int&, long long int*>::_Self]' must have 'int' as its argument 222 | operator--(int) _GLIBCXX_NOEXCEPT | ^~~~~~~~
s870722882
p03673
C++
#include <bits/stdc++.h> #include <algorithm> #include <vector> #define rep(i,n) for(int i=0;i<(n);++i) #define pb(x) push_back(x) #define mp(x, y) make_pair(x, y) using namespace std; typedef long long ll; int main() { int n; vector <int> a(200005); vector <int> b; cin>>n; rep(i,n) cin>>a.at(i); int m=n%2; rep(i,n) { if(i%2==m) { b.insert(a[i]); } else { b.pb(a[i]); } } rep(i,n) { cout<<b[i]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:21:21: error: no matching function for call to 'std::vector<int>::insert(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 21 | b.insert(a[i]); | ~~~~~~~~^~~~~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Alloc = std::allocator<int>]' 1484 | insert(const_iterator __position, _InputIterator __first, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/vector:72: /usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]' 133 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:133:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]' 1395 | insert(const_iterator __position, value_type&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1413 | insert(const_iterator __position, initializer_list<value_type> __l) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; size_type = long unsigned int; value_type = int]' 1439 | insert(const_iterator __position, size_type __n, const value_type& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate expects 3 arguments, 1 provided
s644685973
p03673
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] m = new int[N]; int[] ans = new int[]; for(int i=0;i<N;i++) { m[i] = sc.nextInt(); } if(N%2==0) { for(int i =0;i<N/2;i++) ans[i] = m[N-1-2*i]; for(int i =0;i<N/2;i++) ans[i+N/2]= m[2*i]; } else { for(int i= 0;i<(N+1)/2;i++) ans[i] = m[N-1-2*i]; for(int i= 0;i<(N-1)/2;i++) ans[i] = m[2+2*i]; } for(int i=0;i<N;i++)System.out.println(ans[i]+" "); } }
Main.java:8: error: array dimension missing int[] ans = new int[]; ^ 1 error
s258373896
p03673
C++
#include <bits/stdc++.h> #define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) #define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++) #define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--) #define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--) #define ALL(v) (v).begin(),(v).end() #define MOD 1000000007 #define NIL -1 #define FI first #define SE second #define MP make_pair #define PB push_back #define SZ(x) (int)x.size() #define SP(x) setprecision((int)x) using namespace std ; typedef long long ll; typedef vector<int> vint; typedef vector<vint> vvint; typedef vector<string> vstr; typedef pair<int, int> pii; const int INF = 1e9; const ll LINF = 1e18; const double EPS = 1e-9; ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数 ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数 //------------------------------------------------- // void print(vector<int> vec){ int n = SZ(vec) ; REP(i,n){ cout << vec.at(i) <<" " ; } cout <<endl ; } //------------------------------------------------- int main() { cin.tie(0); ios::sync_with_stdio(false); int n ; cin >> n ; vector<int> a(n) ; REP(i,n){ cin >> a.at(i) ; } deque<int> deq ; vector<int> ans ; REP(i,n){ if(i%2==0){ deq.push_front(a.at(i)) ; } else{ deq.push_back(a.at(i)) ; } } if(n%2==0){ REP(i,n){ ans.push_back(deq.back()) ; deq.pop_back() ; } } else{ REP(i,n){ ans.push_back(dqq.front()) ; deq.pop_front() ; } } print(ans) ; return 0 ; }
a.cc: In function 'int main()': a.cc:72:21: error: 'dqq' was not declared in this scope; did you mean 'deq'? 72 | ans.push_back(dqq.front()) ; | ^~~ | deq
s626485919
p03673
C++
#include <bits/stdc++.h> #define maxn 200005 #define ll long long using namespace std; int main() { int n; cin>>n; vector<int> v; for(int i=0;i<n;i++){ cin>>pre[i]; } int i; for(i=n-1;i>=0;i-=2){ v.push_back(pre[i]); } i ++; if(n % 2 == 1) i += 2; for(;i<=n-2;i+=2){ v.push_back(pre[i]); } for(int i=0;i<v.size();i++){ cout<<v[i]<<" "; } return 0; }
a.cc: In function 'int main()': a.cc:12:10: error: 'pre' was not declared in this scope; did you mean 'pread'? 12 | cin>>pre[i]; | ^~~ | pread a.cc:16:17: error: 'pre' was not declared in this scope; did you mean 'pread'? 16 | v.push_back(pre[i]); | ^~~ | pread a.cc:21:17: error: 'pre' was not declared in this scope; did you mean 'pread'? 21 | v.push_back(pre[i]); | ^~~ | pread
s599566180
p03673
C++
#include <iostream> #include<string> #include<vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector<long long int>vec_a,vec_b; for (int i = 0; i < n; i++) { int num; cin >> num; vec_a.push_back(num); } for (int i = 0; i < n; i++) { vec_b.push_back(vec_a[i]); reverse(vec_b.begin(), vec_b.end()); } for (int i = 0; i < n ; i++) { cout << vec_b[i] << endl; }
a.cc: In function 'int main()': a.cc:28:10: error: expected '}' at end of input 28 | } | ^ a.cc:8:1: note: to match this '{' 8 | { | ^
s818969980
p03673
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<long> a(n),b(n); for(int i=0; i<n; i++){ cin >> a.at(i); } if(n%2){ for(int i=0; i<n; i++){ if(i<(n+1)/2){cout << a.at(n-1-2*i) << ' ';} else if(i!=n-1){cout << a.at(2*i-n) << ' ';} else{cout << a.at(n-2) << endl;} } } else{ if(i<n/2){cout << a.at(n-1-2*i) << ' ';} else if(i!=n-1){cout << a.at(2*i-n) << ' ';} else{cout << a.at(n-2) << endl;} } }
a.cc: In function 'int main()': a.cc:20:8: error: 'i' was not declared in this scope 20 | if(i<n/2){cout << a.at(n-1-2*i) << ' ';} | ^
s099234354
p03673
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n; cin>>n; deque<int> Q; rep(i,n){ int a; cin>>a; if(i%2==0) Q.emplace_back(a); else Q.emplace_front(a); } if(i%2==0){ rep(i,n) cout<<Q[i]<<endl; } else{ rep(i,n) cout<<Q[n-i-1]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:12: error: 'i' was not declared in this scope 16 | if(i%2==0){ | ^
s836424812
p03673
C
#include<cstdio> int n,a[200010]; inline int read(){ register int ret=0;char c=getchar(); while(c<'0'||c>'9')c=getchar(); while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar(); return ret; } int main() { n=read(); for(register int i=1;i<=n;++i)a[i]=read(); for(register int i=n;i>0;i-=2)printf("%d ",a[i]);//first for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);//second return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s513103768
p03673
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i=0; i<(n); i++) int main() { int n; cin >> n; vector<int> a; vector<int> b; int j = 0; rep(i, n){ cin >> a[i]; b.push_back(a[i]); reverse(b.begin, b.end); } reverse(b.begin, b.end); rep(i, n){ cout << b[i] << ' '; } return 0; }
a.cc: In function 'int main()': a.cc:14:16: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)' 14 | reverse(b.begin, b.end); | ~~~~~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)' 1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) | ^~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed: a.cc:14:16: note: couldn't deduce template parameter '_BIter' 14 | reverse(b.begin, b.end); | ~~~~~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)' 249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last); | ^~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided a.cc:16:12: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)' 16 | reverse(b.begin, b.end); | ~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)' 1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) | ^~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed: a.cc:16:12: note: couldn't deduce template parameter '_BIter' 16 | reverse(b.begin, b.end); | ~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)' 249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last); | ^~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
s839149597
p03673
C++
#include <iostream> #include <vector> #include <list> using namespace std; int main(){ int n;cin>>n; vector<long long> sequence(n);for (int i=0;i<n;i++){cin>>sequence[i];} list<long long> output; for(int i=0;i<n;i++){ if (i%2==0){ if (n%2==0){ output.push_back(sequence[i]); } else { output.push_front(sequence[i]); } } else { if (n%2==0){ output.push_front(sequence[i]); } else { output.push_back(sequence[i]); } } } for (auto it=output.begin();it!=output.end();++it){ if (it == output.end() - 1){ cout << *it << endl; } else { cout << *it << " "; } } return 0; }
a.cc: In function 'int main()': a.cc:26:32: error: no match for 'operator-' (operand types are 'std::__cxx11::list<long long int>::iterator' and 'int') 26 | if (it == output.end() - 1){ | ~~~~~~~~~~~~ ^ ~ | | | | | int | std::__cxx11::list<long long int>::iterator In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:26:34: note: 'std::__cxx11::list<long long int>::iterator' is not derived from 'const std::reverse_iterator<_Iterator>' 26 | if (it == output.end() - 1){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:26:34: note: 'std::__cxx11::list<long long int>::iterator' is not derived from 'const std::move_iterator<_IteratorL>' 26 | if (it == output.end() - 1){ | ^
s140866582
p03673
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin>>n; int a; vector<int> v; for (int i=0;i<n;i++) { cin>>a; if (i%2==0) v.push_back(a); else v.insert(0,a); } if (n%2) reverse(v.begin(),v.end()); for (int x:v) cout<<x<<' '; cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:15:21: error: no matching function for call to 'std::vector<int>::insert(int, int&)' 15 | v.insert(0,a); | ~~~~~~~~^~~~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Alloc = std::allocator<int>]' 1484 | insert(const_iterator __position, _InputIterator __first, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/vector:72: /usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]' 133 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:135:27: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator' 135 | insert(const_iterator __position, const value_type& __x) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]' 1395 | insert(const_iterator __position, value_type&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1395:29: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator' 1395 | insert(const_iterator __position, value_type&& __x) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1413 | insert(const_iterator __position, initializer_list<value_type> __l) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1413:29: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator' 1413 | insert(const_iterator __position, initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; size_type = long unsigned int; value_type = int]' 1439 | insert(const_iterator __position, size_type __n, const value_type& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate expects 3 arguments, 2 provided
s720986286
p03673
C++
#include<iostream> #include<vecor> using namespace std; int main(){ int n; int i; cin >> n; vector<int> a(n+1); for(i=1; i <= n; i++){ int tmp; cin >> tmp; a[i] = tmp; } if(n%2){ for(i=n; i>0; i-=2){ cout << a[i]; } for(i=2; i<n; i+=2){ cout << a[i]; } } else { for(i=n; i>1; i-=2){ cout << a[i]; } for(i=1; i<n; i+=2){ cout << a[i]; } } return 0; }
a.cc:2:9: fatal error: vecor: No such file or directory 2 | #include<vecor> | ^~~~~~~ compilation terminated.
s547137393
p03673
C++
#include<iostream> #include<string> #include<cstdio> #include<cstring> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> #include<stack> #include<unordered_map> #include<utility> #include<cassert> using namespace std; typedef long long ll; typedef unsigned long long ul; typedef unsigned int ui; typedef long double ld; const ll mod = 1000000007; const ll INF = mod * mod; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n-1;i>=0;i--) #define Rep(i,sta,n) for(int i=sta;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define per1(i,n) for(int i=n;i>=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef complex<ld> Point; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair<int, int> P; typedef pair<ld, ld> LDP; typedef pair<ll, ll> LP; typedef vector<int> vec; typedef vector<string> svec; #define fr first #define sc second #define all(c) c.begin(),c.end() #define pb push_back //#define int long long void solve() { int n; cin >> n; int a[200200]; rep(i, N) { cin >> a[i]; } int b[200200]; if(n % 2 == 0) { int j = n - 1, i = 0; while(j > 0) { b[i] = a[j]; j -= 2; i++; } j = 1; while(j < n) { b[i] = a[j]; j += 2; i++; } } rep(i, n) { cout << b[i]; } cout << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); //cout << fixed << setprecision(10); //init(); solve(); //cout << "finish" << endl; return 0; }
a.cc: In function 'void solve()': a.cc:52:12: error: 'N' was not declared in this scope 52 | rep(i, N) { | ^ a.cc:29:32: note: in definition of macro 'rep' 29 | #define rep(i,n) for(int i=0;i<n;i++) | ^
s011774365
p03673
C++
#include <bits/stdc++.h> #define REP(i, n) for(ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF 1000000000000000 using namespace std; typedef long long ll; typedef double db; typedef string str; typedef pair<ll, ll> p; constexpr int MOD = 1000000007; template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void print(const std::vector<int> &v) { std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; }); std::cout << std::endl; } bool check(string tmp) { // cout << tmp << endl; if(tmp.length() % 2 == 1) { cout << "nope" << endl; return false; } else { int len = tmp.length(); string before = tmp.substr(0, len / 2); string after = tmp.substr(len / 2); // cout << before << ":" << after << endl; return before == after; } } int main() { int n; cin >> n; vector<long long> a(n); REP(i, n) { cin >> a[i]; } deque<long long> b; REP(i, n) { if(i % 2 == 1) { b.push_back(a[i]); } else { b.push_front(a[i]) } } if(n % 2 == 1) { reverse(b.begin(), b.end()); } REP(i, n) { cout << b[i] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:55:31: error: expected ';' before '}' token 55 | b.push_front(a[i]) | ^ | ; 56 | } | ~
s899229737
p03673
C++
#include <bits/stdc++.h> #define REP(i, n) for(ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF 1000000000000000 using namespace std; typedef long long ll; typedef double db; typedef string str; typedef pair<ll, ll> p; constexpr int MOD = 1000000007; template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void print(const std::vector<int> &v) { std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; }); std::cout << std::endl; } bool check(string tmp) { // cout << tmp << endl; if(tmp.length() % 2 == 1) { cout << "nope" << endl; return false; } else { int len = tmp.length(); string before = tmp.substr(0, len / 2); string after = tmp.substr(len / 2); // cout << before << ":" << after << endl; return before == after; } } int main() { int n; cin >> n; vector<long long> a(n); REP(i, n) { cin >> a[i]; } vector<long long> b; REP(i, n) { b.push_back(a[i]); b.reserve(); } REP(i, n) { cout << b[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:53:18: error: no matching function for call to 'std::vector<long long int>::reserve()' 53 | b.reserve(); | ~~~~~~~~~^~ In file included from /usr/include/c++/14/vector:72, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/vector.tcc:67:5: note: candidate: 'void std::vector<_Tp, _Alloc>::reserve(size_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; size_type = long unsigned int]' 67 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:67:5: note: candidate expects 1 argument, 0 provided
s134928021
p03673
C++
#include <iostream> #include <vector> int main() { int n; std::cin >> n; std::vector<int> as; for(int i=0; i<n; i++) { int a; std::cin >> a; as.push_back(a); } std::vector<int> bs; for(int i=((as.size()-1)/2)*2; 0<=i; i-=2) { bs.push_back(as[i]); } for(int i=1; i<as.size(); i+=2) { bs.push_back(as[i]); } bool evenFirst = as.size() % 2 == 1; if( ! evenFirst ) { std::reverse(bs.begin(), bs.end()); } for(const auto& e : bs) { std::cout << e << " "; } }
a.cc: In function 'int main()': a.cc:28:28: error: 'reverse' is not a member of 'std' 28 | if( ! evenFirst ) { std::reverse(bs.begin(), bs.end()); } | ^~~~~~~
s584316112
p03673
C++
#include <iostream> #include <fstream> #include <string> #include <cstring> #include <cmath> #include <cstdio> #include <algorithm> #include <iomanip> #include <vector> #include <utility> #include <numeric> #include <stack> #include <queue> using namespace std; #define INF 1000000007 using P = pair<int, int>; using ll = long long; int main(){ int n; cin>>n; int a[114514]; for(int i=0;i<n;i++)cin>>a[i]; vector<int> k; for(int i=0;i<n;i++){ k.push_back(a[i]); reverse(k.begin(), k.end()); } for(int i=0;i<k.size();k++)cout<<k[i]<<" "; cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:28:29: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 28 | for(int i=0;i<k.size();k++)cout<<k[i]<<" "; | ~^~
s066428577
p03673
C++
#include<stdio.h> #include<vector> #include<iostream> #include<deque> using namespace std; int main() { int n; cin >> n; deque<int> b; for(int i = 0; i < n; i++){ int tmp; cin >> tmp; if(i % 2 == 0){ b.push_back(tmp); }else{ b.push_front(tmp); } } if(n % 2 != 0){ reverse(b.begin(), b.end()); } for(int x: b){ cout << x << " "; } }
a.cc: In function 'int main()': a.cc:20:5: error: 'reverse' was not declared in this scope 20 | reverse(b.begin(), b.end()); | ^~~~~~~
s227127524
p03673
C++
#include<stdio.h> #include<vector> #include<iostream> using namespace std; int main() { int n; cin >> n; vector<int> b; for(int i = 0; i < n; i++){ int tmp; cin >> tmp; b.push_back(tmp); reverse(b.begin(), b.end()); } for(int x: b){ cout << x << " "; } }
a.cc: In function 'int main()': a.cc:15:5: error: 'reverse' was not declared in this scope 15 | reverse(b.begin(), b.end()); | ^~~~~~~
s367856027
p03673
C++
#include<bits.stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int>a(n); for(int i=0; i<n; ++i){ cin >> a[i]; reverse(a.begin(), a.end()); } for(int i=0; i<n; ++i){ cout << a[i] << endl; }
a.cc:1:9: fatal error: bits.stdc++.h: No such file or directory 1 | #include<bits.stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s766116632
p03673
C
#include<stdio.h> int main(){ int i,j,k,n,left,right; left=249999; right=250001; int A[500000]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d ",&k); if(i==0){ A[250000]=k; } else{ if(n%2 == (i+1)%2){ A[left--]=k; } else A[right++]=k; } } for(i=left+1;i<right;i++) pritnf("%d ",&A[i]); puts(""); return 0; }
main.c: In function 'main': main.c:25:5: error: implicit declaration of function 'pritnf'; did you mean 'printf'? [-Wimplicit-function-declaration] 25 | pritnf("%d ",&A[i]); | ^~~~~~ | printf
s307703167
p03673
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void){ int N; cin >> N; vector<int>num(N,0); for(int i=0;i<N;i++){ cin >> num[i]; } vector<int>ans; for(int i=0;i<num.size();i++){ ans.push_back(num[i]); reverse(ans,ans + ans.size()); } for(int i=0;i<N;i++){ if(i != N - 1) cout << ans[i] << " "; else cout << ans[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:17:21: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'std::vector<int>::size_type' {aka 'long unsigned int'}) 17 | reverse(ans,ans + ans.size()); | ~~~ ^ ~~~~~~~~~~ | | | | | std::vector<int>::size_type {aka long unsigned int} | std::vector<int> In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:17:32: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'std::vector<int>::size_type' {aka 'long unsigned int'} 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:17:32: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'std::vector<int>::size_type' {aka 'long unsigned int'} 17 | reverse(ans,ans + ans.size()); | ^ In file included from /usr/include/c++/14/string:54: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:17:32: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:17:32: note: mismatched types 'const _CharT*' and 'std::vector<int>' 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:17:32: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'std::vector<int>::size_type' {aka 'long unsigned int'} 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:17:32: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:17:32: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:17:32: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:17:32: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:17:32: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:17:32: note: mismatched types 'const _CharT*' and 'std::vector<int>' 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:17:32: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'std::vector<int>::size_type' {aka 'long unsigned int'} 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:17:32: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | reverse(ans,ans + ans.size()); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:17:32: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | reverse(ans,ans + ans.size()); | ^
s989422605
p03673
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for(int i=0;i<n;i++){ cin >> a.ats(i); } if(n == 1){ cout << a.at(0) << endl; } else if(n%2 == 0){ vector<int> b(n/2); vector<int> c(n/2); for(int i=0;i<n;i++){ if(i%2 == 0){ c.at(i/2) = a.at(i); } else { b.at(i/2) = a.at(i); } } reverse(b.begin(), b.end()); for(int i=0;i<n/2;i++){ cout << b.at(i); } for(int i=0;i<n/2;i++){ cout << c.at(i); } cout << endl; } else { vector<int> b(n/2); vector<int> c(n/2 +1); for(int i=0;i<n;i++){ if(i%2 == 0){ c.at(i/2) = a.at(i); } else { b.at(i/2) = a.at(i); } } reverse(c.begin(), c.end()); for(int i=0;i< n/2 +1;i++){ cout << c.at(i); } for(int i=0;i<n/2;i++){ cout << b.at(i); } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:14: error: 'class std::vector<int>' has no member named 'ats'; did you mean 'at'? 9 | cin >> a.ats(i); | ^~~ | at
s246178372
p03673
C++
#include<iostream> #include<string> #include<typeinfo> #include<vector> #include<algorithm> #include<map> #include<iomanip> typedef long long int ll; using namespace std; int main() { int n; cin >> n; vector<ll> b(n); vector<ll> a(n); for(int i=0; i<n; i++){ cin >> a.at(i); } if(n%2==0){ for(int i=n-1; i>=0; i-=2){ cout << a.at(i) << " "; } for(int i=0; i<=n-1; i+=2){ cout << a.at(i) << " "; } }else{ for(int i=n-1; i>=0; i-=2){ cout << a.at(i)<< " "; } for(int i=1; i<=n-2; i+=2){ cout << a.at(i) << " "; } } cout << endl; return 0; } pro
a.cc:38:1: error: 'pro' does not name a type 38 | pro | ^~~
s088193178
p03673
C++
#include<iostream> #include<algorithm> #include<cmath> #include<string> #include<vector> using namespace std; int main() {  int n,a[200000]; cin >> n; for(int i=0; i<n; i++) { cin >> a[i]; } for(int i=n-1; i>=0; i-=2) { cout << a[i] << " "; } for(int i=n%2; i<n; i+=2) { cout << a[i] << " "; } }
a.cc:8:2: error: extended character   is not valid in an identifier 8 |  int n,a[200000]; | ^ a.cc: In function 'int main()': a.cc:8:2: error: '\U00003000int' was not declared in this scope 8 |  int n,a[200000]; | ^~~~~ a.cc:9:10: error: 'n' was not declared in this scope; did you mean 'yn'? 9 | cin >> n; | ^ | yn a.cc:11:12: error: 'a' was not declared in this scope 11 | cin >> a[i]; | ^ a.cc:14:13: error: 'a' was not declared in this scope 14 | cout << a[i] << " "; | ^ a.cc:17:13: error: 'a' was not declared in this scope 17 | cout << a[i] << " "; | ^
s902742129
p03673
C++
#include"bits/stdc++.h" using namespace std; int n,a[200005]; vector<int> p; main(){ cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; p.push_back(a[i]); reverse(p.begin(),p.end()); } for(int i=0;i<n;i++){ if(i==0){ cout<<a[i]; continue; } cout<<<<" "<<a[i]; } cout<<endl; }
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:18:11: error: expected primary-expression before '<<' token 18 | cout<<<<" "<<a[i]; | ^~
s660229183
p03673
C++
#include"bits/stdc++.h" using namespace std; int n,a[200005]; vector<int> p; main(){ cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; p.push_back(a[i]); reverse(p.begin(),p.end()); } for(int i=0;i<n;i++){ if(i==0){ cout<<a[i]; continue; } cout<<<<" "<<a[i]; } cout<<endl;
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:18:11: error: expected primary-expression before '<<' token 18 | cout<<<<" "<<a[i]; | ^~ a.cc:20:14: error: expected '}' at end of input 20 | cout<<endl; | ^ a.cc:5:7: note: to match this '{' 5 | main(){ | ^
s871380251
p03673
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> a(n), b; b.reverve(n); for(int i=0; i<n; i++) cin >> a.at(i); b.push_back(a.at(0)); for(int i=1; i<n; i++){ b.push_back(a.at(i)); reverse(b.begin(), b.end()); } for(int i=0; i<n; i++){ cout << b.at(i) << " "; } }
a.cc: In function 'int main()': a.cc:8:5: error: 'class std::vector<int>' has no member named 'reverve'; did you mean 'reserve'? 8 | b.reverve(n); | ^~~~~~~ | reserve
s710209839
p03673
Java
import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++){ a[i] = sc.nextInt(); } if(n%2 == 0){ for(int i = n-1; i < n; i-=2){ System.out.print(a[i]+" "); } for(int i = 0; i < n; i+=2){ System.out.print(a[i]+" "); } }else{ for(int i=n-1; i>=0; i-=2){ System.out.print(a[i]+" "); } for(int i=1; i<n; i+=2){ System.out.print(a[i]+" "); } } }
Main.java:26: error: reached end of file while parsing } ^ 1 error
s762656612
p03673
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; List<Integer> b = new ArrayList<Integer>(); for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } for(int i=0; i<n; i++){ b.add(a[i]); Collections.reverse(); } for(int i=0; i<n; i++){ int s = b.get(i); System.out.print(s); } System.out.println(""); } }
Main.java:17: error: method reverse in class Collections cannot be applied to given types; Collections.reverse(); ^ required: List<?> found: no arguments reason: actual and formal argument lists differ in length 1 error
s193488275
p03673
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; List<int> b = new ArrayList<int>(); for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } for(int i=0; i<n; i++){ b.add(a[i]); Collections.reverse(); } for(int i=0; i<n; i++){ int s = b.get(i); System.out.print(s); } System.out.println(""); } }
Main.java:9: error: unexpected type List<int> b = new ArrayList<int>(); ^ required: reference found: int Main.java:9: error: unexpected type List<int> b = new ArrayList<int>(); ^ required: reference found: int Main.java:17: error: method reverse in class Collections cannot be applied to given types; Collections.reverse(); ^ required: List<?> found: no arguments reason: actual and formal argument lists differ in length 3 errors
s524671208
p03673
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; List<int> b = new ArrayList<int>(); for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } for(int i=0; i<n; i++){ b.add(a[i]); Collections.reverse(); } for(int i=0; i<n; i++){ int s = new int(b.get(i)); System.out.print(s); } System.out.println(""); } }
Main.java:21: error: '[' expected int s = new int(b.get(i)); ^ Main.java:21: error: ']' expected int s = new int(b.get(i)); ^ 2 errors
s436753292
p03673
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; List<int> b = new ArrayList<int>(); for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } for(int i=0; i<n; i++){ b.add(a[i]); Collections.reverse(); } for(int i=0; i<n; i++){ inr s = new int(b.get(i)); System.out.print(s); } System.out.println(""); } }
Main.java:21: error: '[' expected inr s = new int(b.get(i)); ^ Main.java:21: error: ']' expected inr s = new int(b.get(i)); ^ 2 errors
s536209290
p03673
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; List<String> b = new ArrayList<String>(); for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } for(int i=0; i<n; i++){ b.add(a[i]); Collections.reverse(); } for(int i=0; i<n; i++){ String s = new String(get(i)); System.out.print(s); } System.out.println(""); } }
Main.java:16: error: incompatible types: int cannot be converted to String b.add(a[i]); ^ Main.java:17: error: method reverse in class Collections cannot be applied to given types; Collections.reverse(); ^ required: List<?> found: no arguments reason: actual and formal argument lists differ in length Main.java:21: error: cannot find symbol String s = new String(get(i)); ^ symbol: method get(int) location: class Main Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 3 errors
s346870211
p03673
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; List<String> b = new ArrayList<String>(); for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } for(int i=0; i<n; i++){ b.add(a[i]); Collections.reverse(); } for(int i=0; i<n; i++){ int s = new int(b.get(i)); System.out.print(s); } System.out.println(""); } }
Main.java:21: error: '[' expected int s = new int(b.get(i)); ^ Main.java:21: error: ']' expected int s = new int(b.get(i)); ^ 2 errors
s851024582
p03673
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; List<String> b = new ArrayList<String>(); for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } for(int i=0; i<n; i++){ b[i] = a[i]; Collections.reverse(); } for(int i=0; i<n; i++){ System.out.print(i[0]); } System.out.println(""); } }
Main.java:15: error: array required, but List<String> found b[i] = a[i]; ^ Main.java:16: error: method reverse in class Collections cannot be applied to given types; Collections.reverse(); ^ required: List<?> found: no arguments reason: actual and formal argument lists differ in length Main.java:20: error: array required, but int found System.out.print(i[0]); ^ 3 errors
s668434435
p03673
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; List<String> b = new ArrayList<String>(); for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } for(int i=0; i<n; i++){ b[0] = a[i]; Collections.reverse(); } for(int i=0; i<n; i++){ System.out.print(i[0]); } System.out.println(""); } }
Main.java:15: error: array required, but List<String> found b[0] = a[i]; ^ Main.java:16: error: method reverse in class Collections cannot be applied to given types; Collections.reverse(); ^ required: List<?> found: no arguments reason: actual and formal argument lists differ in length Main.java:20: error: array required, but int found System.out.print(i[0]); ^ 3 errors
s824709148
p03673
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; List<String> b = new ArrayList<String>(); for(int i=0; i<n; i++){ a[] = sc.nextInt(); } for(int i=0; i<n; i++){ b[0] = a[i]; Collections.reverse(); } for(int i=0; i<n; i++){ System.out.print(i[0]); } System.out.println(""); } }
Main.java:11: error: not a statement a[] = sc.nextInt(); ^ Main.java:11: error: ';' expected a[] = sc.nextInt(); ^ 2 errors
s413528514
p03673
C++
#include<utility> #include<vector> using namespace std; int main(void){ int n; scanf("%d",&n); int a[n]; vector<int> b; for(int i = 0;i < n;i++){ int p; scanf("%d",&p); a[i] = p; } for(int i = 0;i < n;i++){ int I = i; b.push_back(a[i]); for(int z = 0;z <= I;z++){ swap(b[z],b[I]); I--; } } for(int i = 0;i < n;i++){ int p = b[i]; printf("%d ",p); } }
a.cc: In function 'int main()': a.cc:7:3: error: 'scanf' was not declared in this scope 7 | scanf("%d",&n); | ^~~~~ a.cc:25:5: error: 'printf' was not declared in this scope 25 | printf("%d ",p); | ^~~~~~ a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 2 | #include<vector> +++ |+#include <cstdio> 3 | using namespace std;
s317545579
p03673
C
#include <stdio.h> #include <stdlib.h> typedef struct { long weight; long parent,rchild,lchild; } HTNode, *HuffmanTree; HTNode HT[100001]; typedef long **HuffmanCode; typedef struct temp_result { long s1; long s2; } temp_re; temp_re select(HuffmanTree HT,long n) { long i,s,flag=0; HuffmanTree p; temp_re answer; answer.s1=answer.s2=0; for(p=HT,i=1; i<=n-1; i++) { if(HT[i].parent==0) { if(flag==0) { s=(HT[i].weight+HT[i+1].weight); answer.s1=i; answer.s2=i+1; flag=1; }else{ if(HT[i].weight+HT[i+1].weight<s) { answer.s1=i; answer.s2=i+1; s=HT[i].weight+HT[i+1].weight; } } } } return answer; } long HuffmanCoding(long *w,long n) { long m=2*n-1; long i,sum=0; HuffmanTree p; temp_re t_r; for(p=HT,i=1; i<=n; i++,p++,w++) { HT[i].weight=*w; (p+i)->lchild=(p+i)->rchild=(p+i)->parent=0; } for(; i<=m; i++,p++) { HT[i].lchild=HT[i].parent=HT[i].rchild=HT[i].weight=0; } for(i=n+1; i<=m; i++) { t_r=select(HT,i-1); HT[t_r.s1].parent=i; HT[t_r.s2].parent=i; HT[i].lchild=t_r.s1; HT[i].rchild=t_r.s2; HT[i].weight=HT[t_r.s1].weight+HT[t_r.s2].weight; sum+=HT[i].weight; } return sum; } void deal() { long t,n,j,i,*p,result; scanf("%ld",&t); for(i=0;i<t;i++) { scanf("%ld",&n); p=(long*)malloc(n*sizeof(long)); for(j=0;j<n;j++) { scanf("%ld",&(*(p+j))); } result=HuffmanCoding(p,n); printf("%ld\n",result); } } int main() { deal(); return 0; }
main.c:15:9: error: conflicting types for 'select'; have 'temp_re(struct <anonymous> *, long int)' {aka 'struct temp_result(struct <anonymous> *, long int)'} 15 | temp_re select(HuffmanTree HT,long n) | ^~~~~~ In file included from /usr/include/x86_64-linux-gnu/sys/types.h:179, from /usr/include/stdlib.h:514, from main.c:2: /usr/include/x86_64-linux-gnu/sys/select.h:102:12: note: previous declaration of 'select' with type 'int(int, fd_set * restrict, fd_set * restrict, fd_set * restrict, struct timeval * restrict)' 102 | extern int select (int __nfds, fd_set *__restrict __readfds, | ^~~~~~
s670364623
p03673
C
#include <stdio.h> #include <stdlib.h> typedef struct { long weight; long parent,rchild,lchild; } HTNode, *HuffmanTree; HTNode HT[100001]; typedef long **HuffmanCode; typedef struct temp_result { long s1; long s2; } temp_re; temp_re select(HuffmanTree HT,long n) { long i,s,flag=0; HuffmanTree p; temp_re answer; answer.s1=answer.s2=0; for(p=HT,i=1; i<=n-1; i++) { if(HT[i].parent==0) { if(flag==0) { s=(HT[i].weight+HT[i+1].weight); answer.s1=i; answer.s2=i+1; flag=1; }else{ if(HT[i].weight+HT[i+1].weight<s) { answer.s1=i; answer.s2=i+1; s=HT[i].weight+HT[i+1].weight; } } } } return answer; } long HuffmanCoding(long *w,long n) { long m=2*n-1; long i,sum=0; HuffmanTree p; temp_re t_r; for(p=HT,i=1; i<=n; i++,p++,w++) { HT[i].weight=*w; (p+i)->lchild=(p+i)->rchild=(p+i)->parent=0; } for(; i<=m; i++,p++) { HT[i].lchild=HT[i].parent=HT[i].rchild=HT[i].weight=0; } for(i=n+1; i<=m; i++) { t_r=select(HT,i-1); HT[t_r.s1].parent=i; HT[t_r.s2].parent=i; HT[i].lchild=t_r.s1; HT[i].rchild=t_r.s2; HT[i].weight=HT[t_r.s1].weight+HT[t_r.s2].weight; sum+=HT[i].weight; } return sum; } void deal() { long t,n,j,i,*p,result; scanf("%ld",&t); for(i=0;i<t;i++) { scanf("%ld",&n); p=(long*)malloc(n*sizeof(long)); for(j=0;j<n;j++) { scanf("%ld",&(*(p+j))); } result=HuffmanCoding(p,n); printf("%ld\n",result); } } int main() { deal(); return 0; }
main.c:15:9: error: conflicting types for 'select'; have 'temp_re(struct <anonymous> *, long int)' {aka 'struct temp_result(struct <anonymous> *, long int)'} 15 | temp_re select(HuffmanTree HT,long n) | ^~~~~~ In file included from /usr/include/x86_64-linux-gnu/sys/types.h:179, from /usr/include/stdlib.h:514, from main.c:2: /usr/include/x86_64-linux-gnu/sys/select.h:102:12: note: previous declaration of 'select' with type 'int(int, fd_set * restrict, fd_set * restrict, fd_set * restrict, struct timeval * restrict)' 102 | extern int select (int __nfds, fd_set *__restrict __readfds, | ^~~~~~
s146902224
p03673
C
#include<stdio.h> #include<stack> #include<queue> using namespace std; int main() { int n,i,j; long long x; stack<long long>s; queue<long long>q; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%lld",&x); q.push(x); for(j=0;j<=i;j++) { s.push(q.front()); q.pop(); } for(j=0;j<=i;j++) { q.push(s.top()); s.pop(); } } for(i=0;i<n-1;i++) { printf("%lld ",q.front()); q.pop(); } printf("%lld ",q.front()); }
main.c:2:9: fatal error: stack: No such file or directory 2 | #include<stack> | ^~~~~~~ compilation terminated.
s086991512
p03673
C
#include<iostream> #include<queue> #include<cstdio> using namespace std; int main() { deque<int> ans; int n; scanf("%d",&n); for(int i = 1; i<=n; i++) { int num; scanf("%d",&num); if(i&1) ans.push_front(num); else ans.push_back(num); } int i = 0; if(n&1) { while(i<n-1) { printf("%d ",ans.front()); ans.pop_front(); i++; } printf("%d\n",ans.front()); } else { while(i<n-1) { printf("%d ",ans.back()); ans.pop_back(); i++; } printf("%d\n",ans.back()); } return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s378127159
p03673
C++
#include<iostream> using namespace std; int main() { int n; cin >> n; string s; for (int i = 0; i < n; ++i) { char ch; cin >> ch; s += ch; reverse(s.begin(), s.end()); } for (int i = 0; i < s.size(); ++i) { cout << s[i] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: 'reverse' was not declared in this scope 9 | reverse(s.begin(), s.end()); | ^~~~~~~
s635053472
p03673
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> Pii; typedef vector<ll> Vi; typedef vector<Vi> VVi; const double EPS = (1e-7); const ll INF =(1e13); const double PI = (acos(-1)); const ll MOD = ll(1e9) + 7; #define REP(i, n) for(ll i = 0; i < (ll)(n); i++) #define REPR(i, n) for(ll i = n; i > -1; i--) #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define ALL(x) (x).begin(),(x).end() #define SORT(x) sort((x).begin(), (x).end()) #define RSORT(x) sort((x).rbegin(), (x).rend()) #define REVERSE(x) reverse((x).begin(), (x).end()) #define SZ(x) ((ll)(x).size()) #define pb push_back #define mp make_pair //chmax(a, b): a>bならaをbで更新 更新したときにtrueを返す //chmin(a, b): a<bならaをbで更新 更新したときにtrueを返す template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #define dump(x) cerr<< #x << "= " << (x) << endl; ll gcd(ll a, ll b){return b?gcd(b,a%b):a;} ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;} ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (b % 2 == 0) return (pow(a * a, b / 2, m) % m); else return (pow(a * a, b / 2) * a) % m;} ll residue(ll a, ll m){return ((a % m) + m) % m;}; ll dx[4]={1,0,-1,0}; ll dy[4]={0,1,0,-1}; int main(){ ll N; cin >> N; Vi a(N); REP(i, N) cin >> a[i]; for(ll i = N - 1; i >= 0; i = i - 2){ cout << a[i] << ' '; } for(ll i = N % 2; i < N; i = i + 2){ cout << a[i] << ((i == N - 2) ? endl : ' ') ; } }
a.cc: In function 'int main()': a.cc:48:44: error: overloaded function with no contextual type information 48 | cout << a[i] << ((i == N - 2) ? endl : ' ') ; | ^~~
s255470072
p03673
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; vector<int> a(n); for(int i=0; i<n; i++) cin>>a.at(i); vector<int> b(0); for(int i=0; i<n; i++){ b.push_back(a.at(i)); reverse(b.begin(),b.end()); } for(int i=0; i<n; i++){ if(i==n-1;) cout<<b.at(i)<<endl; else cout<<b.at(i)<<' '; } }
a.cc: In function 'int main()': a.cc:13:15: error: expected primary-expression before ')' token 13 | if(i==n-1;) cout<<b.at(i)<<endl; | ^
s140095390
p03673
C++
#include<iostream> #include<vector> using namespace std; int main() { vector<int>b; int n, a; cin >> n; for (int i = 0; i < n; i++) { cin >> a; b.push_back(a); reverse(b.begin(), b.end()); } for (int i = 0; i < n; i++) { cout << b[i]; if (i != n - 1) { cout << ' '; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:17: error: 'reverse' was not declared in this scope 12 | reverse(b.begin(), b.end()); | ^~~~~~~
s127439583
p03673
C++
#include<iostream> #include<vector> using namespace std; vector<int>b; void swap() { reverse(b.begin(), b.end()); } int main() { int n, a; cin >> n; for (int i = 0; i < n; i++) { cin >> a; b.push_back(a); swap(); } for (int i = 0; i < n; i++) { cout << b[i]; if (not i != n - 1) { cout << ' '; } } cout << endl; return 0; }
a.cc: In function 'void swap()': a.cc:8:9: error: 'reverse' was not declared in this scope 8 | reverse(b.begin(), b.end()); | ^~~~~~~
s716433581
p03673
C++
#include<iostream> #include<vector> using namespace std; vector<int>b; void swap() { reverse(b.begin(), b.end()); } int main() { int n, a; cin >> n; for (int i = 0; i < n; i++) { cin >> a; b.push_back(a); swap(); } for (int i = 0; i < n; i++) { cout << b[i] << ' '; } cout << endl; return 0; }
a.cc: In function 'void swap()': a.cc:8:9: error: 'reverse' was not declared in this scope 8 | reverse(b.begin(), b.end()); | ^~~~~~~
s763936355
p03673
C++
#include<iostream> #include<vector> using namespace std; vector<int> swap(vector<int>b) { reverse(b.begin(), b.end()); return b; } int main() { vector<int>b; int n, a; cin >> n; for (int i = 0; i < n; i++) { cin >> a; b.push_back(a); b = swap(b); } for (int i = 0; i < b.size(); i++) { cout << b[i] << ' '; } cout << endl; return 0; }
a.cc: In function 'std::vector<int> swap(std::vector<int>)': a.cc:6:9: error: 'reverse' was not declared in this scope 6 | reverse(b.begin(), b.end()); | ^~~~~~~
s392756725
p03673
Java
import java.util.Scanner; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Collections; public class Main { public static void main(String args[]) throws InterruptedException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); List<Integer> list = new LinkedList<Integer>(n); for (int i = 1; i <= n; i++) { if(isEven(i)){ list.add(0,sc.nextInt()); }else{ list.add(sc.nextInt()); } } if(isEven(n)){ for (int i = 0; i < n; i++) { System.out.print(list.get(i)+ " "); } }else{ for (int i = 0; i < n; i++) { System.out.print(list.get(list.size()-1-i)+" "); } } sc.close(); } public static boolean isEven(int n ) { if (n % 2 == 0) { return true; }else{ return false; } } }
Main.java:12: error: incompatible types: int cannot be converted to Collection<? extends Integer> List<Integer> list = new LinkedList<Integer>(n); ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s692232016
p03673
Java
import java.util.*;public class Main{public static void main(String[]a){Scanner s=new Scanner(System.in);int n=s.nextInt();int[]m=new int[n];for(int i=0;i<n;i++)m[i]=sc.nextInt();for(int i=n-1;i>=0;i-=2)System.out.print(m[i]+" ");for(int i=n%2;i<n;i+=2)System.out.print(m[i]+" ");}}
Main.java:1: error: cannot find symbol import java.util.*;public class Main{public static void main(String[]a){Scanner s=new Scanner(System.in);int n=s.nextInt();int[]m=new int[n];for(int i=0;i<n;i++)m[i]=sc.nextInt();for(int i=n-1;i>=0;i-=2)System.out.print(m[i]+" ");for(int i=n%2;i<n;i+=2)System.out.print(m[i]+" ");}} ^ symbol: variable sc location: class Main 1 error
s072990018
p03673
C++
#include<iostream> #include<algorithm> #include<vector> #include<deque> #include<iomanip> using namespace std; int main(){ int n; cin >> n; vector<long long int> a, b(0); long s; for(int i = 0; i < n; i++){ cin >> a; if((n + i) % 2 == 0){ b.push_back(a); } else { b.insert(b.begin(), a); } } for(int i = 0; i < n; i++){ cout << b[i] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<long long int>') 13 | cin >> a; | ~~~ ^~ ~ | | | | | std::vector<long long int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'} 352 | operator>>(__streambuf_type* __sb); | ~~~~~~~~~~~~~~~~~~^~~~ In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/
s798737275
p03673
C++
#include<iostream> #include<algorithm> #include<vector> #include<deque> #include<iomanip> using namespace std; int main(){ int n; cin >> n; vector<long> a, b(0); long s; for(int i = 0; i < n; i++){ cin >> a; if((n + i) % 2 == 0){ b.push_back(a); } else { b.insert(b.begin(), a); } } for(int i = 0; i < n; i++){ cout << b[i] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<long int>') 13 | cin >> a; | ~~~ ^~ ~ | | | | | std::vector<long int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<long int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<long int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<long int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<long int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<long int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<long int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<long int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<long int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<long int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<long int>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<long int>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<long int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<long int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<long int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<long int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<long int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<long int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'} 352 | operator>>(__streambuf_type* __sb); | ~~~~~~~~~~~~~~~~~~^~~~ In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41,
s673053238
p03673
C++
#include<bits/stdc++.h> #include<deque> #include<iomanip> using namespace std; int main(){ int n; cin >> n; vector<long> a(0), b(0); long s; for(int i = 0; i < n; i++){ cin >> a[i]; if((n + i) % 2 == 0){ b.push_back(a[i]); } else { b.insert(b.begin(), a); } } for(int i = 0; i < n; i++){ cout << b[i] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:15: error: no matching function for call to 'std::vector<long int>::insert(std::vector<long int>::iterator, std::vector<long int>&)' 16 | b.insert(b.begin(), a); | ~~~~~~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = long int; _Alloc = std::allocator<long int>]' 1484 | insert(const_iterator __position, _InputIterator __first, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/vector:72: /usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator; const_iterator = std::vector<long int>::const_iterator; value_type = long int]' 133 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:135:57: note: no known conversion for argument 2 from 'std::vector<long int>' to 'const std::vector<long int>::value_type&' {aka 'const long int&'} 135 | insert(const_iterator __position, const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator; const_iterator = std::vector<long int>::const_iterator; value_type = long int]' 1395 | insert(const_iterator __position, value_type&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1395:54: note: no known conversion for argument 2 from 'std::vector<long int>' to 'std::vector<long int>::value_type&&' {aka 'long int&&'} 1395 | insert(const_iterator __position, value_type&& __x) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator; const_iterator = std::vector<long int>::const_iterator]' 1413 | insert(const_iterator __position, initializer_list<value_type> __l) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1413:70: note: no known conversion for argument 2 from 'std::vector<long int>' to 'std::initializer_list<long int>' 1413 | insert(const_iterator __position, initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator; const_iterator = std::vector<long int>::const_iterator; size_type = long unsigned int; value_type = long int]' 1439 | insert(const_iterator __position, size_type __n, const value_type& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate expects 3 arguments, 2 provided
s088457589
p03673
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s058255504
p03673
C++
#include <bits/stdc++.h> using namespace std; int main(){ vector<int>a; int n; cin >> n; for(int i=0;i<n;i++){ int k; cin >> k; if (i&1){ a.insert(a.begin(),k); } else{ a.puch_back(k); } if (a.size()&1){ reverse(a.begin(),a.end()) } for(int i=0;i<n-1;i++){ cout << a[i] << ""; } cout << a[n-1] << endl; return 0; } }
a.cc: In function 'int main()': a.cc:16:15: error: 'class std::vector<int>' has no member named 'puch_back'; did you mean 'push_back'? 16 | a.puch_back(k); | ^~~~~~~~~ | push_back a.cc:19:39: error: expected ';' before '}' token 19 | reverse(a.begin(),a.end()) | ^ | ; 20 | } | ~
s967455033
p03673
C++
/** * ABc 66 C * author : kyomukyomupurin * created : 2018-09-08 08:56:37 **/ #include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; } int start = n / 2; int b[n] = {}; b[start] = a[0]; if (n % 2 == 0){ for (int i = start + 1; i < n - 1; ++i) { b[i] = a[2 * (i - start)]; } for (int i = start - 1; i >= 0; --i) { b[i] = a[2 * (start - i) - 1] } } else { for (int i = start + 1; i < n - 1; ++i) { b[i] = a[2 * (i - start) - 1]; } for (int i = start - 1; i >= 0; --i) { b[i] = a[2 * (start - i)]; } } for (int i = 0; i < n; ++i) { cout << b[i] << " "; } return 0; }
a.cc: In function 'int main()': a.cc:28:42: error: expected ';' before '}' token 28 | b[i] = a[2 * (start - i) - 1] | ^ | ; 29 | } | ~
s365170578
p03673
C++
#include <stdio.h> #include <iostream> #include <vector> using namespace std; int main(){ int n, p; vector<int> b; b.clear(); cin >> n; vector<int> a; for(int i=0;i<n;i++){ cin >> p; a.push_back(p); } for(int i=0;i<n;i++){ b.push_back(a[i]); reverse(b.begin(), b.end()); } for(int i=0;i<n;i++) cout << b[i] << " "; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:17: error: 'reverse' was not declared in this scope 22 | reverse(b.begin(), b.end()); | ^~~~~~~
s122615538
p03673
C++
#include <stdio.h> #include <iostream> #include <vector> using namespace std; int main(){ int n, p; vector<int> b; b.clear(); cin >> n; vector<int> a; for(int i=0;i<n;i++){ cin >> p; a.push_back(p); } for(int i=0;i<n;i++){ b.push_back(a[i]); reverse(b.begin(), b.end()); } for(int i=0;i<n;i++) cout << b[i] << " "; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:17: error: 'reverse' was not declared in this scope 22 | reverse(b.begin(), b.end()); | ^~~~~~~
s241327683
p03673
C++
#include <stdio.h> #include <iostream> #include <vector> using namespace std; int main(){ int n; cin >> n; int a[n]; for(int i=0;i<n-1;i++) cin >> a[i]; vector<int> b; b.clear(); for(int i=0;i<n;i++){ b.push_back(a[i]); reverse(b.begin(), b.end()); } for(int i=0;i<n;i++) cout << b[i] << " "; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:17: error: 'reverse' was not declared in this scope 21 | reverse(b.begin(), b.end()); | ^~~~~~~
s719437885
p03673
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include <cstdio> #include <bits/stdc++.h> #include <set> #include <map> #include <stdio.h> #include <stack> #include <queue> #include <deque> using namespace std; using ll = long long; map <int ,int> mpa,mpb; typedef pair<ll, ll> P; priority_queue<P, vector<P>, greater<P>> pque; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); ll N; cin >> N; deque<int> deq; int t; for(int i=0;i<N;i++){ cin >> t; if(i%2==0){ deq.push_front(t); }else{ deq.push_back(t); } } *auto itr = deq.begin(); while(itr!=deq.end()){ if(itr!=deq.begin()){ cout << " "; } cout << *itr; itr++; } return 0; }
a.cc: In function 'int main()': a.cc:35:4: error: expected primary-expression before 'auto' 35 | *auto itr = deq.begin(); | ^~~~ a.cc:36:9: error: 'itr' was not declared in this scope 36 | while(itr!=deq.end()){ | ^~~