submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s743522553
p03846
C++
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef long long ll; typedef long double ld; int main(){ int t=1; //cin>>t; while(t--){ int n; cin>>n; ll MOD=1e9+7; map<int,int> a; for(int i=0;i<n;i++){ int x; cin>>x; a[x]++; } if(n%2==0){ for(auto j: a){ if(j.first%2==0 || j.second!=2){ cout<<0; return 0; } } ll ans=1; for (int i=0; i<N/2; i++) { ans *= 2; ans %= MOD; } } else{ for(auto j: a){ if(j.first==0 && j.second!=1){ cout<<0; return 0; } else{ if(j.first%2!=0 && j.second!=2){ cout<<0; return 0; } } } ll ans=1; for (int i=0; i<N/2; i++) { ans *= 2; ans %= MOD; } } } }
a.cc: In function 'int main()': a.cc:29:29: error: 'N' was not declared in this scope 29 | for (int i=0; i<N/2; i++) { | ^ a.cc:48:29: error: 'N' was not declared in this scope 48 | for (int i=0; i<N/2; i++) { | ^
s801840166
p03846
C++
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef long long ll; typedef long double ld; int main(){ int t=1; //cin>>t; while(t--){ int n; cin>>n; map<int,int> a; for(int i=0;i<n;i++){ int x; cin>>x; a[x]++; } sort(a.begin(),a.end()); if(n%2==0){ for(auto j: a){ if(j.first%2==0 || j.second!=2){ cout<<0; return 0; } } cout<<2*n; } else{ for(auto j: a){ if(j.first==0 && j.second!=1){ cout<<0; return 0; } if(j.first%2!=0 || j.second!=2){ cout<<0; return 0; } } cout<<ceil((float)n/2)*2; } } }
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: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = _Rb_tree_iterator<pair<const int, int> >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = _Rb_tree_iterator<pair<const int, int> >]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:20:13: required from here 20 | sort(a.begin(),a.end()); | ~~~~^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1906:50: error: no match for 'operator-' (operand types are 'std::_Rb_tree_iterator<std::pair<const int, int> >' and 'std::_Rb_tree_iterator<std::pair<const int, int> >') 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60: /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: /usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const int, int> >' is not derived from 'const std::reverse_iterator<_Iterator>' 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ /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: /usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const int, int> >' is not derived from 'const std::move_iterator<_IteratorL>' 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const int, int> >' is not derived from 'const std::valarray<_Tp>' 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const int, int> >' is not derived from 'const std::valarray<_Tp>' 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const int, int> >' is not derived from 'const std::valarray<_Tp>' 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ In file included from /usr/include/c++/14/valarray:605: /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const int, int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const int, int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const int, int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const int, int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_iterator<std::pair<const int, int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~^~~~~~~~~ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)' 465 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::c
s455577494
p03846
C++
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define pb(s) push_back(s) #define mp(a,b) make_pair(a,b) #define f first #define s second #define ALL(v) v.begin(), v.end() #define ALLA(arr, sz) arr, arr + sz #define SORT(v) sort(ALL(v)) #define REVERSE(v) reverse(ALL(v)) #define SORTA(arr, sz) sort(ALLA(arr, sz)) #define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) #define PI 3.14159265358979323846264338327950L #define MOD 1000000007 typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; void solve() { int n; cin>>n; vi v(n+1); for(int i=1;i<=n;++i)cin>>v[i]; sort(v.begin()+1,v.end()); if(n%2==0){ for(int i=1;i<n;i+=2){ if(v[i]!=i||v[i+1]!=i||v[i]!=v[i+1]){ cout<<0<<endl; return; } } cout<<pow(2,n/2)%MOD<<endl; } else{ if(v[1]==0){ for(int i=2;i<n;i+=2){ if(v[i]!=i||v[i+1]!=i||v[i]!=v[i+1]){ cout<<0<<endl; return; } } cout<<pow(2,n/2)%MOD<<endl; } else{ cout<<0<<endl; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); //int t; //cin>>t; //while(t--) solve(); return 0; }
a.cc: In function 'void solve()': a.cc:40:25: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 40 | cout<<pow(2,n/2)%MOD<<endl; | ~~~~~~~~~~^ | | | __gnu_cxx::__promote<double>::__type {aka double} a.cc:50:29: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 50 | cout<<pow(2,n/2)%MOD<<endl; | ~~~~~~~~~~^ | | | __gnu_cxx::__promote<double>::__type {aka double}
s122258684
p03846
Java
import java.util.*; import java.math.*; public class Main { static BigDecimal a = new BigDecimal("2"); static BigDecimal b = new BigDecimal("2"); static BigDecimal c = new BigDecimal("1000000007"); public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N= sc.nextInt(); int check =0, total =0; int[] a = new int[N]; for (int i =0; i<N; i++) { int b = sc.nextInt(); if (b * N % 2 != 0 || b >= N) { break; } a[b]++; total += b; } if (total != N * N / 2) check++; for (int i=N-1; i>0; i -=2) { if (a[i] != 2) check++; } if (check != 0) { System.out.println(0); } else { for (int i =2; i<= N/2; i++) { a = a.multiply(b); } a = a.remainder(c); System.out.println(a); } } }
Main.java:31: error: cannot find symbol a = a.multiply(b); ^ symbol: method multiply(BigDecimal) location: variable a of type int[] Main.java:33: error: cannot find symbol a = a.remainder(c); ^ symbol: method remainder(BigDecimal) location: variable a of type int[] 2 errors
s567606913
p03846
C++
#include <iostream> #include<cmath> using namespace std; int find(int arr[], int i, int num){ for(int j=0;j<i;j++){ if(arr[j]==num){ return j; } } return -1; } int main() { int a; cin>>a; int a_len=a; int arr[a]; for(int i=0;i<a;i++){ cin>>arr[i]; } bool fail=false; if(a%2==1){ int j=find(arr,a,0); if(j==-1){ fail=true; } else{ arr[j]=-1; } a_len--; } int rpNum=1+a%2; int i=0; while(i<a_len&&!fail){ int j1=find(arr,a,rpNum); if(j1==-1){ //cout<<"FAILED"<<endl; fail=true; } else{ arr[j1]=-1; } int j2=find(arr,a,rpNum); //cout<<"Finding: "<<rpNum<<" Round:"<<i/2<<endl; if(j1==-1){ //cout<<"FAILED"<<endl; fail=true; } else{ arr[j2]=-1; //cout<<j1<<" and "<<j2<<" are -1"<<endl; i+=2; rpNum+=2; } } for(int i=0;i<a;i++){ if(arr[i]!=-1){ //cout<<"FAIL AT "<<i<<". Number is "<<arr[i]<<endl; fail=true; break; } } if(fail){ cout<<0<<endl; } else{ cout<<pow(2.0,a_len/2)%pow(10.0,9.0)+7<<endl; } }
a.cc: In function 'int main()': a.cc:67:39: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'double' to binary 'operator%' 67 | cout<<pow(2.0,a_len/2)%pow(10.0,9.0)+7<<endl; | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ | | | | | double | __gnu_cxx::__promote<double>::__type {aka double}
s666791366
p03846
C++
#include <iostream> #include<algorithm> using namespace std; const int P=1000000007; int main() { int n; cin>>n; int arr[n]; for(int i=0;i<n;i++){ cin>>arr[i]; } sort(arr,arr+n); if(n%2==0){ int x=1; for(int i=0;i<n;i+=2){ if(arr[i]==i+1 and arr[i+1]==i+1){ x*=2; x%=P; }else{ x=0; break; } } cout<<x<<endl; }else{ int x=1; if(arr[0]!=0){ cout<<0<<endl; }else{ for(int i=1;i<n;i+=2){ if(arr[i]==i+1 and arr[i+1]==i+1){ x*=2; x%=P; }else{ x=0; break; } } cout<<x<<endl; }
a.cc: In function 'int main()': a.cc:41:10: error: expected '}' at end of input 41 | } | ^ a.cc:26:8: note: to match this '{' 26 | }else{ | ^ a.cc:41:10: error: expected '}' at end of input 41 | } | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s965208132
p03846
C++
#include<bits/stdc++.h> using namespace std; typedef long long int ll; #define mod ll(1e9+7) ll power(ll x){ ll temp=1; for(ll i=0;i<x;i++){ temp=((temp%mod)*(2%mod))%mod; } return temp; } int main() { ll i,n,a[1000000],status=0,temp=0,cou=0,ans; cin>>n; for(i=0;i<n;i++) { cin>>a[i]; } if(n==1&&a[0]=0) { cout<<1; return 0; } sort(a,a+n); if(n%2==0) { status=0; } else { status=1; } if(status==0) { if(a[0]==0) { cout<<0; return 0; } for(i=0;i<n;i++) { if(a[i]==a[i+1]) { temp++; if(temp==1) { cou++; } } else { temp=0; } if(temp>1) { cout<<0; return 0; } } } if(status==1) { if(a[0]!=0) { cout<<0; return 0; } if(a[0]==a[1]) { cout<<0; return 0; } for(i=1;i<n;i++) { if(a[i]==a[i+1]) { temp++; if(temp==1) { cou++; } } else { temp=0; } if(temp>1) { cout<<0; return 0; } } } if(cou!=n/2) { cout<<0; return 0; } cou=power(cou); cout<<(cou)%mod; return 0; } // #include<bits/stdc++.h> // using namespace std; // typedef long long int ll; // #define mod ll(1e9+7) // void solve(){ // ll n; // cin>>n; // vector<ll> arr(n); // vector<ll> freq(n); // ll prod=1; // for( ll&x:arr)cin>>x,freq[x]++; // if(freq[0]>=2){cout<<0<<endl;return;} // if(n%2==0 and freq[0]>0){cout<<0<<endl;return;} // for(ll i=0;i<freq.size();i++){ // if(freq[i]>2){ // cout<<0;return; // } // if(freq[i]) // prod=(prod%mod*(freq[i]%mod))%ll(1e9+7); // } // cout<<prod<<endl; // } // int main(){ // solve(); // }
a.cc: In function 'int main()': a.cc:22:12: error: lvalue required as left operand of assignment 22 | if(n==1&&a[0]=0) | ~~~~^~~~~~
s806435462
p03846
C++
#include<bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll i,n,a[1000000],status=0,temp=0,cou=0; cin>>n; for(i=0;i<n;i++) { cin>>a[i]; } sort(a,a+n); if(n%2==0) { status=0; } else { status=1; } if(status==0) { if(a[0]==0) { cout<<1; return 0; } for(i=0;i<n;i++) { if(a[i]==a[i+1]) { temp++; if(temp==1) { cou++; } } else { temp=0; } if(temp>1) { cout<<1; return 0; } } } if(status==1) { if(a[0]==a[1]) { cout<<0; return 0; } for(i=1;i<n;i++) { if(a[i]==a[i+1]) { temp++; if(temp==1) { cou++; } } else { temp=0; } if(temp>1) { cout<<1; return 0; } } } cout<<(cou*2)%(pow(10,9)+7); return 0; }
a.cc: In function 'int main()': a.cc:80:18: error: invalid operands of types 'll' {aka 'long long int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 80 | cout<<(cou*2)%(pow(10,9)+7); | ~~~~~~~^~~~~~~~~~~~~~ | | | | | __gnu_cxx::__promote<double>::__type {aka double} | ll {aka long long int}
s585418854
p03846
C++
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_multiset tree<long long , null_type,less_equal<long long >, rb_tree_tag,tree_order_statistics_node_update> #define ordered_set tree<long long , null_type,less<long long >, rb_tree_tag,tree_order_statistics_node_update> using namespace std; #define ll long long #define f(i,a,b) for(ll i=a;i<=b;++i) #define mod 1000000007 const double pi =3.14159265358979323846; ll biexp(ll a,ll n) { if(n==0) return 1; ll res=1; while(n>0) { if(n%2!=0) res*=a; a=a*a; n=n/2; res=res%mod; } res=(res%mod) return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin>>n; map<ll,ll>m; for(ll i=0;i<n;++i) { ll tp; cin>>tp; m[tp]++; } if(n&1){ bool flag=true; for(auto x:m) { if(x.first%2==0){ if(x.first==0){ if(x.second != 1) {flag=0; break;} } else { if(x.second != 2) {flag=0; break;} } } else {flag=0; break;} } if(flag) cout<<biexp(2,m.size()-1); else cout<<0; } else { bool flag=true; for(auto x:m) { if(x.first%2!=0){ if(x.second != 2) {flag=0; break;} } else {flag=0; break;} } if(flag) cout<<biexp(2,m.size()); else cout<<0; } return 0; } /** pair<ll,ll>fib(ll n) { if(n==0) return {0,1}; pair<ll , ll >p=fib(n/2); ll c=p.first*(2*p.second - p.first) ; ll d=p.second*p.second + p.first*p.first; if(n&1) return {d,c+d}; else return {c,d}; } **/ /** freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); **/ /**check for perfect square. ll is_perfect_square(ll n) { ll tp=floor(sqrt(n)); if(n==(tp*tp)) return tp; else return -1; } **/ /** ll biexp(ll a,ll n) { if(n==0) return 1; ll res=1; while(n>0) { if(n%2!=0) res*=a; a=a*a; n=n/2; } return res; } **/ /** sieve implementation**/ /** ll N=1299827; // first 100008 primes; vector<ll>lp(N+1,0); vector<ll>pr; for(ll i=2;i<=N;++i) { if(lp[i]==0) { lp[i]=i; pr.push_back(i); } for(ll j=0;j<pr.size() and i*pr[j]<=N ;++j) { lp[i*pr[j]]=pr[j]; } } **/ /** bool isprime(ll n) { if(n<2) return false; for(ll i=2;i*i<=n;++i) { if(n%i==0) return false; } return true; } **/ /**factors in sqrt(n); ll N=100000; vector<vector<ll> >factors(N+1); for(ll j=1;j<=N;++j) { for(ll x=1;x*x<=j;++x) { if(j%x==0) { factors[j].push_back(x); if(j/x != x) factors[j].push_back(j/x); } } } **/ /** vector<pair<ll,ll> >prime_factors(ll n) { vector<pair<ll,ll> >res; ll ct=0; if(!(n&1)) { while(!(n&1)) { ct++; n/=2; } res.push_back({2,ct}); } ct=0; for(ll i=3;i*i<=n;i+=2) { while(n%i==0) { ct++; n/=i; } if(ct>0) res.push_back({i,ct}); ct=0; } if(n!=1) res.push_back({n,1}); return res; } **/ /** calculating n_C_r(); ll ncr(ll n, ll k) { ll res = 1; for (ll i = 1; i <= k; ++i) res = (res*(n-k+i))/i; return res; } **/
a.cc: In function 'long long int biexp(long long int, long long int)': a.cc:23:18: error: expected ';' before 'return' 23 | res=(res%mod) | ^ | ; 24 | return res; | ~~~~~~ a.cc:23:8: warning: control reaches end of non-void function [-Wreturn-type] 23 | res=(res%mod) | ~~~^~~~~~~~~~
s017911909
p03846
C++
#include <iostream> #include <algorithm> #include <cstring> #include <string> #include <cmath> #define ll long long ll MOD=1e9+7; ll a[100005]; using namespace std; int main(){ ll n; cin>>n; ll flag=1;//flag ll ans=1; if(n%2==0){ // even number for(ll i=0;i<n;i++){ ll x; cin>>x; a[x]++;//a[7]++ / / give data x error if(x>=n || x%2==0 || a[x]>2){ flag=0; cout<<"0"<<endl; break; } //The correct situation if(a[x]==1) ans=ans*2%MOD; // a * b %c == a%c * b%c } } else{ //odd for(ll i=0;i<n;i++){ ll x; cin>>x; a[x]++; / / give data x error if(x>=n || x%2==1 || a[0]>1 ||a[x]>2){ flag=0; cout<<"0"<<endl; break; } //The correct situation if(x!=0 && a[x]==1) ans=ans*2%MOD; } } if(flag) cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:26:25: error: expected primary-expression before '/' token 26 | / / give data x error | ^ a.cc:26:27: error: expected primary-expression before '/' token 26 | / / give data x error | ^ a.cc:26:29: error: 'give' was not declared in this scope 26 | / / give data x error | ^~~~ a.cc:46:25: error: expected primary-expression before '/' token 46 | / / give data x error | ^ a.cc:46:27: error: expected primary-expression before '/' token 46 | / / give data x error | ^ a.cc:46:29: error: 'give' was not declared in this scope 46 | / / give data x error | ^~~~
s795066626
p03846
C++
using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef vector<int> vi; struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; const int MAXN = 100100; const int MOD = 1e9+7; int cnt[MAXN]; int solve(int N) { ll ans = 1; if (N % 2 == 1) { if (cnt[0] != 1) return 0; for (int i = 2; i < N; i += 2) { if (cnt[i] != 2) return 0; (ans *= 2) %= MOD; } return ans; } else { for (int i = 1; i < N; i+=2) { if (cnt[i] != 2) return 0; (ans *= 2) %= MOD; } return ans; } } int main() { int N; cin >> N; for (int i = 0; i < N; i++) { int a; cin >> a; cnt[a]++; } cout << solve(N) << endl; return 0; }
a.cc:4:9: error: 'pair' does not name a type 4 | typedef pair<int, int> pii; | ^~~~ a.cc:5:9: error: 'vector' does not name a type 5 | typedef vector<int> vi; | ^~~~~~ a.cc: In constructor 'cww::cww()': a.cc:6:18: error: 'ios' has not been declared 6 | struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; | ^~~ a.cc:6:46: error: 'cin' was not declared in this scope 6 | struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc: In function 'int main()': a.cc:32:9: error: 'cin' was not declared in this scope 32 | cin >> N; | ^~~ a.cc:32:9: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:38:9: error: 'cout' was not declared in this scope 38 | cout << solve(N) << endl; | ^~~~ a.cc:38:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:38:29: error: 'endl' was not declared in this scope 38 | cout << solve(N) << endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std;
s202458152
p03846
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll ; #define rep(i,n) for(int i = 0 ; i < n ;i++) int end(){ cout << 0 << endl; return 0 ; } ll const mod = 1e9+7 ; int main(){ int n ; cin >> n ; ll ans = 1 ; map<int,int> mp ; rep(i,n){ int a ; cin >> a ; mp[a]++ ; } if(n%2 == 1){ if(mp[0]!=1){ end(); return 0 ;} rep(i,n/2) if(mp[2*(i+1)]!=2){ end(); return 0 ;} rep(i,n/2){ ans = 2*ans%mod ; } cout << ans << endl; } if(n%2 == 0){ if(mp[0]!=0){ end(); return 0 ;} rep(i,n/2){ //if(mp[2*(i+1)]!=0) if(mp[2*i+1]!=2){ end(); return 0 ;} rep(i,n/2){ ans = 2*ans%mod ; } cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:41:2: error: expected '}' at end of input 41 | } | ^ a.cc:13:11: note: to match this '{' 13 | int main(){ | ^
s739330409
p03846
C++
#ifdef DEBUG #else # pragma GCC optimize("O3,no-stack-protector") # pragma GCC optimize("unroll-loops") # if __cplusplus < 201703L # pragma GCC target("avx") # else # pragma GCC target("avx2") # endif #endif // 実数の場合 // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define _USE_MATH_DEFINES #include <bits/stdc++.h> #define dump(x) cout << x << endl typedef int64_t Int; typedef long double Ld; using namespace std; using Graph = vector<vector<Int>>; const double pi = M_PI; const Int MOD = 1000000007; // 二分累乗法 template <typename T> T modpow(T a, T n, T mod) { T ret = 1; if (mod == 1) { while (n > 0) { if (n & 1) { ret = ret * a; } a = a * a; n >>= 1; } } else { while (n > 0) { if (n & 1) { ret = ret * a % mod; } a = a * a % mod; n >>= 1; } } return ret; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); Int n; cin >> n; map<Int, Int> m; for (Int i = 0; i < n; i++) { Int in; cin >> in; if (!m.insert({in, 1}).second) { m[in]++; } } bool isok = true; Int ans = 0; if (n % 2 == 1) { if (m.count(0) == 0) { isok = false; } else { if (m[0] != 1) { isok = false; } } n--; for (Int i = 2; i <= n; i += 2) { if (m.count(i) == 0) { isok = false; break; } else { if (m[i] != 2) { isok = false; break; } } } } else { if (m.count(0) == 1) { isok = false; } n--; for (Int i = 1; i <= n; i += 2) { if (m.count(i) == 0) { isok = false; break; } else { if (m[i] != 2) { isok = false; break; } } } } n++; if (isok) { ans = modpow(2LL, (n / 2LL), MOD); } else { ans = 0; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:116:21: error: no matching function for call to 'modpow(long long int, long long int, const Int&)' 116 | ans = modpow(2LL, (n / 2LL), MOD); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~ a.cc:32:3: note: candidate: 'template<class T> T modpow(T, T, T)' 32 | T modpow(T a, T n, T mod) { | ^~~~~~ a.cc:32:3: note: template argument deduction/substitution failed: a.cc:116:21: note: deduced conflicting types for parameter 'T' ('long long int' and 'long int') 116 | ans = modpow(2LL, (n / 2LL), MOD); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~
s509245728
p03846
C++
#ifdef DEBUG #else # pragma GCC optimize("O3,no-stack-protector") # pragma GCC optimize("unroll-loops") # if __cplusplus < 201703L # pragma GCC target("avx") # else # pragma GCC target("avx2") # endif #endif // 実数の場合 // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define _USE_MATH_DEFINES #include <bits/stdc++.h> #define dump(x) cout << x << endl typedef int64_t Int; typedef long double Ld; using namespace std; using Graph = vector<vector<Int>>; const double pi = M_PI; const Int MOD = 1000000007; // 二分累乗法 template <typename T> T modpow(T a, T n, T mod) { T ret = 1; if (mod == 1) { while (n > 0) { if (n & 1) { ret = ret * a; } a = a * a; n >>= 1; } } else { while (n > 0) { if (n & 1) { ret = ret * a % mod; } a = a * a % mod; n >>= 1; } } return ret; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); Int n; cin >> n; map<Int, Int> m; for (Int i = 0; i < n; i++) { Int in; cin >> in; if (!m.insert({in, 1}).second) { m[in]++; } } bool isok = true; Int ans = 0; if (n % 2 == 1) { if (m.count(0) == 0) { isok = false; } else { if (m[0] != 1) { isok = false; } } n--; for (Int i = 2; i <= n; i += 2) { if (m.count(i) == 0) { isok = false; break; } else { if (m[i] != 2) { isok = false; break; } } } } else { if (m.count(0) == 1) { isok = false; } n--; for (Int i = 1; i <= n; i += 2) { if (m.count(i) == 0) { isok = false; break; } else { if (m[i] != 2) { isok = false; break; } } } } n++; if (isok) { ans = modpow(2, (n / 2), MOD); } else { ans = 0; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:116:21: error: no matching function for call to 'modpow(int, Int, const Int&)' 116 | ans = modpow(2, (n / 2), MOD); | ~~~~~~^~~~~~~~~~~~~~~~~ a.cc:32:3: note: candidate: 'template<class T> T modpow(T, T, T)' 32 | T modpow(T a, T n, T mod) { | ^~~~~~ a.cc:32:3: note: template argument deduction/substitution failed: a.cc:116:21: note: deduced conflicting types for parameter 'T' ('int' and 'long int') 116 | ans = modpow(2, (n / 2), MOD); | ~~~~~~^~~~~~~~~~~~~~~~~
s529195244
p03846
C++
#include <iostream> #include <sstream> // istringstream #include <string> #include <algorithm> #include <cmath> #include <vector> using namespace std; int main() { int N; cin >> N; int A[N]; for(int i=0; i<N; ++i) cin >> A[i]; // 記録 int memo[100000+10] = {0}; for(int i=0; i<N; ++i){ memo[A[i]]++; } bool flag = true; if(N%2 != 0){ // 奇数人の場合 if(memo[0] != 1){ // 0が必ず一人いる flag = false; } for(int i=2; i<N; i+=2){ if(memo[i] != 2){ // 各偶数が2人ずつ flag = false; } } } else{ // 偶数人の場合 for(int i=1; i<N/2; i+=2){ if(memo[i] != 2){ // 各奇数が2人ずつ flag = false; } } } long long ans = pow(2, N/2) % (1000000000+7); if(!flag) ans = 0; // cout << pow(2, 10) << endl; // cout << pow(2, 100) << endl; // cout << pow(2, 1000) << endl; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:42:33: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 42 | long long ans = pow(2, N/2) % (1000000000+7); | ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s237940126
p03846
C++
#include<bits/stdc++.h> using namespace std; #define ll long long #define mod 1e9+7 ll i,j,k,l; ll mypow(ll a,ll b){ ll num=1; while(b!=0){ num*=a; num%=mod; b--; } return num; } int main(){ ll n;cin>>n; vector<ll> a(n); for(ll i=0;i<n;i++){cin>>a[i];} ll ans=0; sort(a.begin(),a.end()); if(n%2==1){ if(a[0]!=0){cout<<0<<endl;return 0;} for(i=1;i<n-1;i+=2){ if(a[i+1]!=a[i]){cout<<0<<endl;return 0;} } for(i=1;i<n-2;i+=2){ if(a[i+2]!=a[i]+2){cout<<0<<endl;return 0;} } ans=(a[n-1])/2; }else{ for(i=0;i<n-1;i+=2){ if(a[i+1]!=a[i]){cout<<0<<endl;return 0;} } for(i=0;i<n-2;i+=2){ if(a[i+2]!=a[i]+2){cout<<0<<endl;return 0;} } ans=(a[n-1]+1)/2; } cout<<mypow(2,ans)<<endl; return 0; }
a.cc: In function 'long long int mypow(long long int, long long int)': a.cc:12:12: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 12 | num%=mod; | ^ a.cc:12:12: note: in evaluation of 'operator%=(long long int, double)'
s173696511
p03846
C++
#include <bits/stdc++.h> #define ll long long using namespace std; inline int D() { int t; scanf("%d",&t); return t; } inline ll llD(){ ll t; scanf("%lld",&t); return t; } const int N=2e5+9; int arr[N]; ll mod=1e9+7,sum=0; int main(){ int n =D(); int k=2; int T=0; if(n==1) return cout<<1,0; bool r=0; for(int i=1; (i<=n) ;i++) { int a=D(); if(!arr[a]) arr[a]++, sum++; else arr[a]++; if(arr[a]>2) r=1; if((n&1) && (a&1)) r=1; if((n%2==0) && (a%2==0)) r=1; } if(r) return printf("0"),0; if(sum==1) return puts("2"),0; if((n/2 != sum) return printf("0"),0; if(n&1) sum--; printf("%d",(sum*sum)%mod); } /** bool ok(int val){ int cntm=0,cntp=0; for(int i=0;i<n-val;i++) { cntm=0;cntp=0; for(int j=i;j<val;j++) { (arr[j]==1)?cntp++:cntm++; } if(cntp==cntm) break; } return cntp==cntm; } int binarySearch(){ int low = 0, med, hi =n; while(low<hi){ med = (low+hi+1)>>1; cout<<med<<" "<<hi<<" "<<low<<endl; if(ok(med)) low = med; else hi = med-1; } return low; }*/ /** int power1(int b, int p){ //O(p) if(!p) return 1; return b*power1(b, p-1); } int power2(int b, int p){ //O(Log(p)) if(!p) return 1; int ret = power2(b, p/2); return (p&1 ? ret*ret*b : ret*ret); } int mul(int a, int b, int m){ return (a%m * b%m) % m; } */ /** void seive() { bitset<N>iscomp; iscomp[0]=iscomp[1]=1; for(long long i=2; i<=N; ++i) { if(!iscomp[i]) { a.push_back(i); for(long long j=i*i; j<=N; j+=i) iscomp[j]=1; } } } 3 abc abc */ /** */
a.cc: In function 'int main()': a.cc:44:20: error: expected ';' before 'return' 44 | if((n/2 != sum) | ^ | ; 45 | return printf("0"),0; | ~~~~~~ a.cc:46:1: error: expected primary-expression before 'if' 46 | if(n&1) | ^~ a.cc:45:26: error: expected ')' before 'if' 45 | return printf("0"),0; | ^ | ) 46 | if(n&1) | ~~ a.cc:44:7: note: to match this '(' 44 | if((n/2 != sum) | ^
s270566831
p03846
C++
#include <iostream> #include <algorithm> #include <cstring> #include <string> #include <cmath> #define ll long long ll MOD=1e9+7; ll a[100005]; using namespace std; int main(){ ll n; cin>>n; ll flag=1;//flag ll ans=1; if(n%2==0){ // even number for(ll i=0;i<n;i++){ ll x; cin>>x; a[x]++;//a[7]++ / / give data x error if(x>=n || x%2==0 || a[x]>2){ flag=0; cout<<"0"<<endl; break; } //The correct situation if(a[x]==1) ans=ans*2%MOD; // a * b %c == a%c * b%c } } else{ //odd for(ll i=0;i<n;i++){ ll x; cin>>x; a[x]++; / / give data x error if(x>=n || x%2==1 || a[0]>1 ||a[x]>2){ flag=0; cout<<"0"<<endl; break; } //The correct situation if(x!=0 && a[x]==1) ans=ans*2%MOD; } } if(flag) cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:26:25: error: expected primary-expression before '/' token 26 | / / give data x error | ^ a.cc:26:27: error: expected primary-expression before '/' token 26 | / / give data x error | ^ a.cc:26:29: error: 'give' was not declared in this scope 26 | / / give data x error | ^~~~ a.cc:46:25: error: expected primary-expression before '/' token 46 | / / give data x error | ^ a.cc:46:27: error: expected primary-expression before '/' token 46 | / / give data x error | ^ a.cc:46:29: error: 'give' was not declared in this scope 46 | / / give data x error | ^~~~
s666615525
p03846
C++
#include <bits/stdc++.h> using namespace std; static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }(); int main(){ long long int mod=1e9+7; long long int n; cin>>n; vector<long long int> nums(100005); long long int ans=1; long long int flag=1; if(n%2==0){ for(long long int i=0;i<n;i++){ long long int x; cin>>x; nums[x]++; if(x>=2 || x%2==0 || nums[x]>2){ flag=0; cout<<0<<"\n"; break; } if(nums[x]==1){ ans = ans*2%mod; } } } else{ for(long long int i = 0;i<n;i++){ long long int x; cin>>x; nums[x]++; if(x>=n || x%2==1 || nums[0]>1 || nums[x]>2){ flag=0; cout<<0<<"\n"; break; } if(x!=0 && nums[x]==1){ ans=ans*2%mod; } } } if(posible) cout<<ans<<"\n"; return 0; }
a.cc: In function 'int main()': a.cc:42:6: error: 'posible' was not declared in this scope 42 | if(posible) | ^~~~~~~
s127796903
p03846
C++
#include <iostream> #include <vector> #include <set> #include <cmath> using namespace std; bool is_possible(vector<int> row){ vector<int> numbers(row.size(),0); //for (int i: numbers) printf("%d",i); for (int i: row){ if (numbers[i/2] == 0) numbers[i/2]+=1; else if (numbers[i/2] == 1 && i != 0) numbers[i/2]+=1; else if (numbers[i/2] == 2) return false; else return false; } return true; } int main(){ int n; scanf("%d",&n); vector<int> row(n); for (int&k : row){ scanf("%d",&k); } if (is_possible(row)){ int result = pow(2,n/2); printf("\n%d",result%(pow(10,9)+5)); } else printf("\n%d",0); return 0; }
a.cc: In function 'int main()': a.cc:30:37: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 30 | printf("\n%d",result%(pow(10,9)+5)); | ~~~~~~^~~~~~~~~~~~~~ | | | | int __gnu_cxx::__promote<double>::__type {aka double}
s434791427
p03846
C++
#include <iostream> #include <string> #include<vector> #include<algorithm> using namespace std; #define ll long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() using vi = vector<int>; const int MOD = 1e9 + 7; int main() { int N; cin >> N; int a = 1; vi A(N); vi even(N); vi odd(N); rep(i, N) { cin >> A[i]; } sort(all(A)); rep(i, N / 2) { even[2 * i] = 2 * i + 1; even[2 * i + 1] = 2 * i + 1; } odd[0] = 0; rep(i, (N-1) / 2) { odd[2 * i + 2] = 2 * i + 2; odd[2 * i + 1] = 2 * i + 2; } if (N % 2 == 0) { if (A != even) a = 0; } else { if (A != odd) a = 0; } ll ans = 0; if (a == 1) ans = pow(2, N / 2); cout << ans % MOD << endl; }
a.cc: In function 'int main()': a.cc:44:23: error: 'pow' was not declared in this scope 44 | if (a == 1) ans = pow(2, N / 2); | ^~~
s978444188
p03846
C++
#include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() using vi = vector<int>; const int MOD = 1e9+7; int main() { int main() { int N; cin >> N; int a = 1; vi A(N); rep(i, N) { cin >> A[i]; } sort(all(A)); if (N % 2 == 0) { rep(i, N / 2) { if (A[2 * i] != A[2 * i + 1] || A[2 * i] != 2 * i + 1 || A[2 * i + 1] != 2 * i + 1) a = 0; } } else { if (A[0] != 0) a = 0; rep(i, (N - 1) / 2) { if (A[2 * i + 1] != A[2 * i + 2] || A[2 * i + 1] != (2 * i + 2) ) a = 0; } } ll ans = 0; if (a == 1) ans = pow(2, N / 2); cout << ans % MOD << endl; }
a.cc: In function 'int main()': a.cc:14:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 14 | int main() { | ^~ a.cc:14:9: note: remove parentheses to default-initialize a variable 14 | int main() { | ^~ | -- a.cc:14:9: note: or replace parentheses with braces to value-initialize a variable a.cc:14:12: error: a function-definition is not allowed here before '{' token 14 | int main() { | ^ a.cc:38:2: error: expected '}' at end of input 38 | } | ^ a.cc:11:12: note: to match this '{' 11 | int main() { | ^
s666315137
p03846
C++
#include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() using vi = vector<int>; const int MOD = 1e9 + 7; int main() { int N; cin >> N; bool a = true; vi A(N); rep(i, N) { cin >> A[i]; } sort(all(A)); if (N % 2 == 0) { for (int i = 0; i < N / 2;i++) { if (A[2*i] != A[2*i + 1] || A[2*i] != 2*i - 1) a = false; } } else { if (A[0] != 0) a = false; rep(i, (N - 1) / 2) { if (!A[2*i + 1] != A[2*i + 2] || A[2*i + 1] != 2*i + 2) a = false; } } ll ans = 0; if (a == true) ans = pow(2, N / 2); cout << ans % MOD << endl;
a.cc: In function 'int main()': a.cc:36:31: error: expected '}' at end of input 36 | cout << ans % MOD << endl; | ^ a.cc:13:12: note: to match this '{' 13 | int main() { | ^
s806174420
p03846
C++
#include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i, n) for(int i = 0; i < n; i++); using vi = vector<int>; const int MOD = 1e9+7; int main() { int N; cin >> N; bool a = true; vi A[N]; rep(i,N){ cin >> A[i]; } sort(A,A + N); if(N%2 == 0){ rep(i,N/2){ if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) a = false; } } else{ if(!A[0] == 0) a= false; rep(i,(N-1)/2){ if(!A[2i+1]==A[2i+2] || !A[2i+1] == 2i+2) a = false; } } ll ans = 0; if(a == true) ans = pow(2,N/2); cout << ans%MOD << endl; }
a.cc:21:37: error: extended character   is not valid in an identifier 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ a.cc: In function 'int main()': a.cc:16:14: error: 'i' was not declared in this scope 16 | cin >> A[i]; | ^ a.cc:21:22: error: no match for 'operator[]' (operand types are 'vi [N]' {aka 'std::vector<int> [N]'} and 'std::complex<double>') 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ a.cc:21:34: error: no match for 'operator+' (operand types are 'std::complex<double>' and 'int') 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ~~^~ | | | | | int | std::complex<double> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, 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:21:35: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ In file included from /usr/include/c++/14/string:54, 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/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:21:35: note: 'std::complex<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: mismatched types 'const _CharT*' and 'std::complex<double>' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: 'std::complex<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: 'std::complex<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: 'std::complex<double>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: 'std::complex<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: 'std::complex<double>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: mismatched types 'const _CharT*' and 'std::complex<double>' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /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:21:35: note: 'std::complex<double>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 21 | if(!A[2i] == A[2i+1] || !A[2i] == 2i-1) | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note:
s154984995
p03846
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); sort(A.begin(),A.end()); bool x=true; for(int i=0;i<N;i++){ if(N%2==0){ if(A.at(i)!=2*((N/2))+1){x=false; break;} }else{ if(A.at(i)!=2*((N+1)/2)){x=false; break;} } }if(!x) cout<<0<<endl; else{ int ans=1; fo(int i=0;i<(N/2);i++){ ans=(ans*2)%1000000007; }cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:8: error: expected primary-expression before 'int' 22 | fo(int i=0;i<(N/2);i++){ | ^~~ a.cc:22:16: error: 'i' was not declared in this scope 22 | fo(int i=0;i<(N/2);i++){ | ^
s820744620
p03846
C++
#include "bits/stdc++.h" using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<VVI> VVVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef vector<PII> VPII; typedef long long LL; typedef priority_queue<int> PQ_DESC; typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC; typedef priority_queue<PII> PQ_DESC_PII; typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII; typedef vector<LL> VLL; typedef vector<VLL> VVLL; typedef vector<VVLL> VVVLL; #define SORT_ASC(c) sort((c).begin(), (c).end()) #define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define FORL(i,a,b) for(LL i=(a);i<(b);++i) #define REPL(i,n) FORL(i,0,n) #define SIZE(a) int((a).size()) #define ALL(a) (a).begin(),(a).end() const double EPS = 1e-10; const double PI = acos(-1.0); //debug func template<typename T> void vprint(vector<T> v) { for(auto x : v) { cerr << x << " "; } cerr << endl; } template<typename T> void vvprint(vector<vector<T>> vv) { REP(i, SIZE(vv)) { REP(j, SIZE(vv[i])) { cerr << vv[i][j] << " "; } cerr << endl; } } template <typename Iterator> inline bool next_combination(const Iterator first, Iterator k, const Iterator last) { /* Credits: Thomas Draper */ if ((first == last) || (first == k) || (last == k)) return false; Iterator itr1 = first; Iterator itr2 = last; ++itr1; if (last == itr1) return false; itr1 = last; --itr1; itr1 = k; --itr2; while (first != itr1) { if (*--itr1 < *itr2) { Iterator j = k; while (!(*itr1 < *j)) ++j; iter_swap(itr1,j); ++itr1; ++j; itr2 = k; rotate(itr1,j,last); while (last != j) { ++j; ++itr2; } rotate(k,itr2,last); return true; } } rotate(first,k,last); return false; } inline double get_time_sec(void){ return static_cast<double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count())/1000000000; } template<typename T> T gcd(T a, T b) { if(a > b) swap(a, b); if(a == 0) return b; else return gcd(b%a, a); } template<typename T> T lcm(T a, T b) { return (a / gcd(a, b)) * b; } template<typename T> map<T, T> prime_list(T n) { map<T, T> ret; for(T i = 2; i*i <= n; i++) { if(n % i == 0) { ret[i] = 0; while(n % i == 0) { n /= i; ret[i]++; } } } if(n != 1) ret[n]++; return ret; } #define MOD 1000000007 LL mypow(LL a, LL n) { if(n == 1) return a % MOD; if(n % 2 == 1) return (a * mypow(a, n-1)) % MOD; LL t = mypow(a, n/2); return (t * t) % MOD; } int main(void) { LL n; cin >> n; VLL a(n); REP(i, n) cin >> a[i]; sort(ALL(a)); if(n % 2 == 0) { REPL(i, n / 2) { if(a[i*2] != i*2+1) { cout << 0 << endl; return 0; } if(a[i*2+1] != i*2+1) { cout << 0 << endl; return 0; } } cout << mypow(2, n/2) << endl; } else { if(a[0] != 0) { cout << 0 << endl; return 0; } FORL(i, 1, n / 2 + 1) { if(a[i*2-1] != i * 2) { cout << 0 << endl; return 0; } if(a[a[i*2] != i * 2) { cout << 0 << endl; return 0; } } cout << mypow(2, n / 2) << endl; } }
a.cc: In function 'int main()': a.cc:159:33: error: expected ']' before ')' token 159 | if(a[a[i*2] != i * 2) { | ^ | ]
s228695366
p03846
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); } sort(A.begin(), A.end()); int y = N % 2; bool can = true; if (y == 0){ for (int i = 0; i < N; i += 2){ if (A.at(i) != i + 1){ can = false; break; } if (A.at(i + 1) != i + 1){ can = false; break; } } } else{ if (A.at(0) != 0) can = false; for (int i = 1; i < N; i += 2){ if (A.at(i) != i + 1){ can = false; break; } if (A.at(i + 1) != i + 1){ can = false; break; } } } double x = pow(2, N/2); x %= 10000000007; if (can) cout << x << endl; else cout << 0 << endl; }
a.cc: In function 'int main()': a.cc:41:7: error: invalid operands of types 'double' and 'long int' to binary 'operator%' 41 | x %= 10000000007; | ~~^~~~~~~~~~~~~~ a.cc:41:7: note: in evaluation of 'operator%=(double, long int)'
s786610663
p03846
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); } sort(A.begin(), A.end()); int y = N % 2; bool can = true; if (y == 0){ for (int i = 0; i < N; i += 2){ if (A.at(i) != i + 1){ can = false; break; } if (A.at(i + 1) != i + 1){ can = false; break; } } } else{ if (A.at(0) != 0) can = false; for (int i = 1; i < N; i += 2){ if (A.at(i) != i + 1){ can = false; break; } if (A.at(i + 1) != i + 1){ can = false; break; } } } double x = pow(2, N/2) % (pow(10, 9) + 7) if (can) cout << x << endl; else cout << 0 << endl; }
a.cc: In function 'int main()': a.cc:40:28: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 40 | double x = pow(2, N/2) % (pow(10, 9) + 7) | ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~ | | | | | __gnu_cxx::__promote<double>::__type {aka double} | __gnu_cxx::__promote<double>::__type {aka double} a.cc:42:5: error: 'else' without a previous 'if' 42 | else cout << 0 << endl; | ^~~~
s726638513
p03846
C++
#include <iostream> #define MOD 1000000000+7 using namespace std; int main(void){ int n; cin>>n; int a_count[n] = {}; for(int i=0;i<n;i++){ int a; cin>>a; a_count[a] ++; } long long ans=1; for(int i= (n%2)+1;i<n;i+=2){ if(a_count[i] == 2){ ans *= 2 ans %= MOD; }else{ ans = 0; break; } } if(n%2 == 1 && a_count[0] !=1) ans =0; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:17:21: error: expected ';' before 'ans' 17 | ans *= 2 | ^ | ; 18 | ans %= MOD; | ~~~
s736932154
p03846
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 #define MOD 1000000007 vector <ll> g[10]; ll visited[10]; int main(){ ll n; ll i; ll a[(n+1)/2]; for(i=0;i<(n+1)/2;i++){ a[i]=0; } ll A; for(i=0;i<n;i++){ cin >> A; a[A/2]+=1; if((A+N)%2==1||a[A/2]>2){cout << 0;return 0;} if(N%2>0&&a[0]>1){cout << 0;return 0;} } cout << pow(2,n/2); return 0; }
a.cc: In function 'int main()': a.cc:28:15: error: 'N' was not declared in this scope 28 | if((A+N)%2==1||a[A/2]>2){cout << 0;return 0;} | ^ a.cc:29:12: error: 'N' was not declared in this scope 29 | if(N%2>0&&a[0]>1){cout << 0;return 0;} | ^
s405742037
p03846
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[sc.nextInt()]++; } long ans = 0; int pp = 0; long MOD = (long)Math.pow(10, 9) + 7; if((n % 2) == 0) { int p = 0; for(int i = 1; i <= (n - 3); i++) { if(a[i] != 2) p++; } if(p == 0) pp = 1; } else { int p = 0; if(a[0] != 1) p++; for(int i = 2; i <= (n - 3); i++) { if(a[i] != 2) p++; } if(p == 0) pp = 1; } if(pp = 1) { ans = 1; for(int i = 0; i < (n / 2); i++) { ans = (ans * 2) % MOD; } } System.out.println(ans); } }
Main.java:28: error: incompatible types: int cannot be converted to boolean if(pp = 1) { ^ 1 error
s941260605
p03846
C++
import java.util.*; import java.io.*; public class Main{ static int repow(int b,int p){ long a = b; long res=1; while(p>0){ if(p%2==1){ res*=a; } a*=a; p/=2; } return (int)res; } static int repow(int b,int p,int modder){ long a = b%modder; long res=1; while(p>0){ if(p%2==1){ res=(res*a)%modder; } a=(a*a)%modder; p/=2; } return (int)res; } static long repow(long b,long p){ long a = b; long res=1; while(p>0){ if(p%2==1){ res*=a; } a*=a; p/=2; } return res; } static long repow(long b,long p,long modder){ long a = b%modder; long res=1; while(p>0){ if(p%2==1){ res=(res*a)%modder; } a=(a*a)%modder; p/=2; } return res; } static long gcd(long c,long d){ while(true){ long f=c%d; if(f==0){ return d; } c=d; d=f; } } static long lcm(long c,long d){ return c/gcd(c,d)*d; } static ArrayList<Integer> divList(int n){ ArrayList<Integer> div=new ArrayList<Integer>(); for(int i=1;i*i<=n;i++){ if(n%i==0){ div.add(i); if(i*i!=n){ div.add((int)(n/i)); } } } return div; } static ArrayList<Long> divList(long n){ ArrayList<Long> div=new ArrayList<Long>(); for(long i=1;i*i<=n;i++){ if(n%i==0){ div.add(i); if(i*i!=n){ div.add(n/i); } } } return div; } static HashSet<Integer> divSet(int n){ HashSet<Integer> div=new HashSet<Integer>(); for(int i=1;i*i<=n;i++){ if(n%i==0){ div.add(i); div.add((int)(n/i)); } } return div; } static Map<Long,Integer> pFacMap(long x){ Map<Long,Integer> mp=new HashMap<>(); long t=x; for(long i=2;i*i<=x&&i<=t;i++){ if(t%i==0){ int num=0; while(t%i==0){ t/=i; num++; } mp.put(i,num); } } if(t!=1){ mp.put(t,1); } return mp; } static boolean iP(long n){ if(n==2){ return true; } if((n&1)==0||n==1){ return false; } // if(n>3037007383L){ if(n>Integer.MAX_VALUE){ return tameshiwari(n); } long d=n-1; int s=0; while((d&1)==0){ d/=2; s++; } int[] aa = {2,3,5,7,11,13,17}; for(int i=0;i<7&&aa[i]<n;i++){ int a = aa[i]; long t = d; long y=repow(a,t,n); while(t!=n-1&&y!=1&&y!=n-1){ y = (y*y)%n; t=t<<1; } if(y!=n-1&&(t&1)==0){ return false; } } return true; } static boolean tameshiwari(long n){ for(long i=2;i*i<=n;i++){ if(n%i==0){ return false; } } return true; } static class NCK{ int max; int mod; long[] fac; long[] finv; long[] inv; NCK(){ this(510000,1000000007); } NCK(int max,int mod){ this.max=max; this.mod=mod; pre(max,mod); } void pre(int nmax,int nmod){ fac = new long[nmax]; finv = new long[nmax]; inv = new long[nmax]; fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<nmax;i++){ fac[i]=fac[i-1]*i%nmod; inv[i]=nmod-inv[nmod%i]*(nmod/i)%nmod; finv[i]=finv[i-1]*inv[i]%nmod; } } long nCk(int n,int k){ if(n<k){return 0;} if(n<0||k<0){return 0;} return fac[n]*(finv[k]*finv[n-k]%mod)%mod; } } static int kmp(String t,String p){ int[] f=new int[p.length()+1]; int i=0; int j=1; f[1]=0; while(j<p.length()){ if(i==0||p.charAt(i-1)==p.charAt(j-1)){ i++; j++; f[j]=i; }else{ i=f[i]; } } i=1; j=1; while(i<=p.length()&&j<=t.length()){ if(i==0||p.charAt(i-1)==t.charAt(j-1)){ i++; j++; }else{ i=f[i]; } } return i==(p.length()+1)?j-i:-1; } static String StSort(String s){ StringBuilder sb = new StringBuilder(s); int lg = sb.length(); int l; int r; int gaze; for(int i=1;i<lg;i++){ l=0; r=i-1; while(l<=r){ gaze=(l+r)/2; if(sb.charAt(gaze)<=sb.charAt(i)){ l=gaze+1; }else if(sb.charAt(gaze)>sb.charAt(i)){ r=gaze-1; } } sb.insert(l,sb.charAt(i)); sb.deleteCharAt(i+1); } return sb.toString(); } static class Xy{ int x; int y; Xy(int x,int y){ this.x=x; this.y=y; } public int manht(Xy o){ return Math.abs(x-o.x)+Math.abs(y-o.y); } public String toString(){ return "["+x+","+y+"]"; } public double henkaku(){ return Math.atan2(y,x); } public static int hencom(Xy s1,Xy s2){ return (int)Math.signum(s1.henkaku()-s2.henkaku()); } public boolean equals(Object o){ return x==((Xy)o).x&&y==((Xy)o).y; } } static class Zip1{ Map<Long,Integer> zip=new HashMap<>(); long[] unzip; Zip1(long[] a){ Arrays.sort(a); long mae=0;int zure=0; for(int i=0;i<a.length;i++){ if(i==0||mae!=a[i]){ zip.put(a[i],i-zure); mae=a[i]; }else{ zure++; } } unzip=new long[size()]; for(Map.Entry<Long,Integer> me:zip.entrySet()){ unzip[me.getValue()]=me.getKey(); } } int zip(long t){ return zip.get(t); } long unzip(int i){ return unzip[i]; } int size(){ return zip.size(); } } static class UnFd{ int[] parent; int[] size; int forest; UnFd(int n){ parent=new int[n]; size=new int[n]; forest=n; for(int i=0;i<n;i++){ parent[i]=i; size[i]=1; } } private boolean isRoot(int i){ return parent[i]==i; } private int rootOf(int i){ if(isRoot(i)){ return i; } return parent[i]=rootOf(parent[i]); } public boolean same(int i,int j){ return rootOf(i)==rootOf(j); } public void merge(int i,int j){ i=rootOf(i); j=rootOf(j); if(i==j){ return; } size[Integer.min(i,j)]+=size[Integer.max(i,j)]; parent[Integer.max(i,j)]=Integer.min(i,j); forest--; } public int sizeOf(int i){ return size[rootOf(i)]; } public int[] parents(){ return parent; } public int forest(){ return forest; } public String toString(){ return Arrays.toString(parent); } } static class SegTree<T>{ int n; int m; java.util.function.BinaryOperator<T> op; int[] l; int[] r; T[] a; T ident; SegTree(int n,java.util.function.BinaryOperator<T> op,T ident){ this.n=n; this.op=op; this.ident=ident; int ii=n-1; int p=0; while(ii>0){ ii/=2; p++; } m=repow(2,p+1)-1; @SuppressWarnings("unchecked") T[] b=(T[])(new Object[m]); a=b; Arrays.fill(a,ident); l=new int[m]; r=new int[m]; for(int i=0;i<=m/2;i++){ l[m/2+i]=i; r[m/2+i]=i+1; } for(int i=m/2-1;i>=0;i--){ l[i]=l[lch(i)]; r[i]=r[rch(i)]; } } SegTree(int n,java.util.function.BinaryOperator<T> op,T ident,T[] ary){ this.n=n; this.op=op; this.ident=ident; int ii=n-1; int p=0; while(ii>0){ ii/=2; p++; } m=repow(2,p+1)-1; @SuppressWarnings("unchecked") T[] b=(T[])(new Object[m]); a=b; for(int i=0;i<n;i++){ a[m/2+i]=ary[i]; } for(int i=m/2+n;i<m;i++){ a[i]=ident; } for(int i=m/2-1;i>=0;i--){ a[i]=op.apply(a[lch(i)],a[rch(i)]); } l=new int[m]; r=new int[m]; for(int i=0;i<=m/2;i++){ l[m/2+i]=i; r[m/2+i]=i+1; } for(int i=m/2-1;i>=0;i--){ l[i]=l[lch(i)]; r[i]=r[rch(i)]; } } public T getAll(){ return a[0]; } public T get(int from,int to){ if(from<0||n<to||from>=to){ throw new IllegalArgumentException(String.valueOf(from)+","+String.valueOf(to)); } return get(from,to,0); } private T get(int from,int to,int node){ if(from==l[node]&&to==r[node]){ return a[node]; }else{ if(to<=l[node]+(r[node]-l[node])/2){ return get(from,to,lch(node)); }else if(l[node]+(r[node]-l[node])/2<=from){ return get(from,to,rch(node)); }else{ return op.apply(get(from,l[node]+(r[node]-l[node])/2,lch(node)),get(l[node]+(r[node]-l[node])/2,to,rch(node))); } } } public void set(T ob,int i){ if(i<0||n<=i){ throw new IndexOutOfBoundsException(String.valueOf(i)+"isOutFromLength "+String.valueOf(n)); } int j=m/2+i; a[j]=ob; while(true){ if(j==0){ break; } j=prt(j); a[j]=op.apply(a[lch(j)],a[rch(j)]); } } static private int prt(int node){ return (node-1)/2; } static private int lch(int node){ return 2*node+1; } static private int rch(int node){ return 2*node+2; } public String toString(){ return Arrays.toString(a); } } static boolean next_permutation(int[] per){ if(per.length<2){ return false; } int i; for(i=per.length-1;i>0;i--){ if(per[i-1]<per[i]){ break; } } if(0<i){ i--; int tmp; int j; for(j=per.length-1;j>i;j--){ if(per[j]>per[i]){ break; } } //swap(i,j) tmp=per[i]; per[i]=per[j]; per[j]=tmp; for(int k=i+1;k<(i+1+per.length)/2;k++){ //swap(k,per.length-k+i) tmp=per[k]; per[k]=per[per.length-k+i]; per[per.length-k+i]=tmp; } return true; } int tmp; for(int k=0;k<per.length;k++){ //swap(k,per.length-k-1) tmp=per[k]; per[k]=per[per.length-k-1]; per[per.length-k-1]=tmp; } return false; } static boolean next_bits(boolean[] b){ for(int i=0;i<b.length;i++){ if(b[i]){ b[i]=false; }else{ b[i]=true; return true; } } return false; } static class Scnr{ private final InputStream ins; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; Scnr(){ this(System.in); } Scnr(InputStream in){ ins = in; } private boolean hasNextByte(){ if(ptr<buflen){ return true; }else{ ptr = 0; try{ buflen = ins.read(buffer); }catch(IOException e){ e.printStackTrace(); } if(buflen<=0){ return false; } } return true; } private int readByte(){ if(hasNextByte()){ return buffer[ptr++]; }else{ return -1; } } private static boolean isPrintableChar(int c){ return 33<=c&&c<=126; } public boolean hasNext(){ while(hasNextByte()&&!isPrintableChar(buffer[ptr])){ ptr++; } return hasNextByte(); } public String next(){ return nextBuilder().toString(); } public StringBuilder nextBuilder(){ if(!hasNext()){ throw new NoSuchElementException(); } StringBuilder sb = new StringBuilder(); int b = readByte(); while(isPrintableChar(b)){ sb.appendCodePoint(b); b = readByte(); } return sb; } public double nextDouble(){ return Double.parseDouble(next()); } public long nextLong(){ if(!hasNext()){ throw new NoSuchElementException(); } long n = 0; boolean minus = false; int b = readByte(); if(b=='-'){ minus=true; b=readByte(); } if(b<'0'||'9'<b){ throw new NumberFormatException(); } while(true){ if('0'<=b&&b<='9'){ n*=10; n+=b-'0'; }else if(b==-1||!isPrintableChar(b)){ return minus?-n:n; }else{ throw new NumberFormatException(); } b=readByte(); } } public int nextInt(){ long nl=nextLong(); if(nl<Integer.MIN_VALUE||Integer.MAX_VALUE<nl){ throw new NumberFormatException(); } return (int) nl; } public String[] nextA(int n){ String[] a = new String[n]; nextA(a,n); return a; } public void nextA(String[] a,int n){ nextA(a,0,n); } public void nextA(String[] a,int off,int len){ for(int i=off;i<off+len;i++){ a[i]=next(); } } public int[] nextAInt(int n){ int[] a = new int[n]; nextAInt(a,n); return a; } public void nextAInt(int[] a,int n){ nextAInt(a,0,n); } public void nextAInt(int[] a,int off,int len){ for(int i=off;i<off+len;i++){ a[i] = nextInt(); } } public long[] nextALong(int n){ long[] a = new long[n]; nextALong(a,n); return a; } public void nextALong(long[] a,int n){ nextALong(a,0,n); } public void nextALong(long[] a,int off,int len){ for(int i=off;i<off+len;i++){ a[i] = nextLong(); } } public double[] nextADouble(int n){ double[] a = new double[n]; nextADouble(a,n); return a; } public void nextADouble(double[] a,int n){ nextADouble(a,0,n); } public void nextADouble(double[] a,int off,int len){ for(int i=off;i<off+len;i++){ a[i] = nextDouble(); } } public List<Integer> nextLInt(int n){ List<Integer> l = new ArrayList<>(n); for(int i=0;i<n;i++){ l.add(sc.nextInt()); } return l; } public List<Long> nextLLong(int n){ List<Long> l = new ArrayList<>(n); for(int i=0;i<n;i++){ l.add(sc.nextLong()); } return l; } public List<Double> nextLDouble(int n){ List<Double> l = new ArrayList<>(n); for(int i=0;i<n;i++){ l.add(sc.nextDouble()); } return l; } } static Scnr sc = new Scnr(); static PrintWriter out = new PrintWriter(System.out); public static void main(String args[]){ //for(int i=sc.nextInt();i>0;i--) solve(); out.flush(); } static void solve(){ int n=sc.nextInt(); int[] a=sc.nextAInt(n); int[] b=new int[n]; for(int i=0;i<n;i++){ b[a[i]]++; } // System.err.println(Arrays.toString(a)); // System.err.println(Arrays.toString(b)); boolean flag=false; if((n&1)==1&&b[0]!=1){ flag=true; } if((n&1)==0&&b[0]!=0){ flag=true; } for(int i=1;i<n;i++){ if(((n-i)&1)*2!=b[i]){ flag=true; } } if(flag){ out.println(0); }else{ out.println(repow(2,n/2,1_000_000_007)); } } }
a.cc:358:7: error: stray '@' in program 358 | @SuppressWarnings("unchecked") | ^ a.cc:384:7: error: stray '@' in program 384 | @SuppressWarnings("unchecked") | ^ a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.io.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class Main{ | ^~~~~~
s814593109
p03846
C++
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair typedef long long ll; typedef pair<ll,ll> P; typedef pair<ll,int> pli; typedef pair<int,int> pii; #define rep(i,a,b) for(ll i=a ; i<b ; i++) #define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++) const int max_n = 1e5; const ll mod = 1e9+7; const ll INF = 1LL<<60; const int inf = 1e5; //typedef long double ld; 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; } int dx[4] = {0,0,1,-1}; int dy[4] = {1,-1,0,0}; ll mo = 998244353; struct UnionFind { vector<int> par; UnionFind(int n) : par(n, -1) { } void init(int n) { par.assign(n, -1); } int root(int x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } int size(int x) { return -par[root(x)]; } }; int main(){ int n; cin >> n; vector<ll> v(n); map<ll,ll> ma; rep(i,0,n){ cin >> v[i]; ma[v[i]]++; } ll ans=1; bool ok=true; if(n%2==1){ for(auto j : ma){ if(j.fi==0){ if(j.se!=1){ ok=false; } }else{ if(j.se!=2)ok=false; else{ ans *= 2; ans %= mod; } } } if() }else{ for(auto j : ma){ if(j.se!=2) ok=false; else{ ans *= 2; ans %= mod; } } } if(ok)cout << ans << endl; else{ cout << 0 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:76:10: error: expected primary-expression before ')' token 76 | if() | ^ a.cc:77:3: error: expected primary-expression before '}' token 77 | }else{ | ^
s955333649
p03846
C++
/*I wanna be the very best, like no one ever was...*/ #include<bits/stdc++.h> using namespace std; /******* All Required define Pre-Processors and Constants *******/ #define ll long long #define ull unsigned long long #define ld long double #define mem(a, b) memset(a, (b), sizeof(a)) #define rep(i, j, k) for (int i = j ; i < k ; ++i) #define rrep(i, j, k) for (int i = j; i > k; --i) #define all(cont) cont.begin(), cont.end() #define rall(cont) cont.end(), cont.begin() #define foreach(i, a) for(auto i: a) #define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++) #define in(A, B, C) assert( B <= A && A <= C) #define debug(a) cout << #a << ": " << a << endl #define Flag(n) cout << "here " << n << endl #define mp make_pair #define pb push_back #define endl '\n'; #define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); const ll POSITIVE_INFINITY = 9223372036854775807; const ll NEGATIVE_INFINITY = -9223372036854775807; const ll MOD = 1000000007; const ld PI = acos(-1.0); #define TRACE #ifdef TRACE #define see(...) __f(#__VA_ARGS__,__VA_ARGS__) template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr<<name<<" : "<<arg1<<endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...); } #else #endif int pow(int a , int n ){ ll res =1; while(n){ if(n%2==1){ res= (res*a)%MOD; } a=(a*a)%MOD; n/=2; } return res; } int main() { io; // freopen("in","r",stdin); // freopen("out","w",stdout); ll n; cin>>n; if (n == 1) { int p; cin >> p; if (p == 0) cout<<1; else cout<<0; return 0; } vector<ll> v(n); rep(i,0,n)cin>>v[i]; ll flag = 1; sort(all(v)); for(long i=n-1; i>1; i-=2){ if(i!=0){ if(v[i]!=i || v[i-1]!=i){ flag=false; } }else{ if(v[0]!=0){ flag=false; } } } if(!flag){ std::cout << 0 << std::endl; }else{ cout<<pow(2,n/2)<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:23:14: error: expected unqualified-id before '\xa' 23 | #define endl '\n'; | ^~~~ a.cc:88:32: note: in expansion of macro 'endl' 88 | std::cout << 0 << std::endl; | ^~~~
s955603397
p03846
C++
#include <bits/stdc++.h> using namespace std; int main() { int no_of_people; cin >> no_of_people ; int difference[no_of_people]; sort(difference,difference+no_of_people); if(difference[1]==0) { cout << 0; } else { cout << 2**(no_of_people/2); } }
a.cc: In function 'int main()': a.cc:17:15: error: invalid type argument of unary '*' (have 'int') 17 | cout << 2**(no_of_people/2); | ^~~~~~~~~~~~~~~~~
s122355145
p03846
C++
/*2020/03/15 ABC 050*/ #include<bits/stdc++.h> using namespace std; using ll = long long; using p = pair<int, int>; int main() { int n; cin >> n; vector<int> vec(n); for(int i=0; i<n; i++) cin >> vec[i]; sort(vec.begin(), vec.end()); int j=-1, k=0; if(n%2==0) { for(int i=0; i<n; i++) { if(i%2==0) j+=2; if(vec[i]!=j) { cout << 0 << endl; return 0; } } } else { for(int i=0; i<n; i++) { if(i%2!=0) k+=2; if(vec[i]!=k) { cout << 0 << endl; return 0; } } } cout << pow(2, n/2) % 1000000007<< endl; return 0; }
a.cc: In function 'int main()': a.cc:33:25: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 33 | cout << pow(2, n/2) % 1000000007<< endl; | ~~~~~~~~~~~ ^ ~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s970281811
p03846
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, s, a; in(n); vector<ll> a(n), b(n); rep(i, n){ in(a[i]); b[a[i]]++; } s = 0; if(n % 2 == 0){ rep(i, n){ if(i == 0){ if(b[i] != 1) s++; } else if(i % 2 == 0){ if(b[i] != 2) s++; } else{ if(b[i] != 0) s++; } } } else{ rep(i, n){ if(i % 2 == 1){ if(b[i] != 2) s++; } else{ if(b[i] != 0) s++; } } } if(s != 0){ out(0); memi; return 0; } s = 0; rep(i, n){ if(b[i] == 2) s++; } a = 1; rep(i, s) a *= 2; out(a); memi; }
a.cc: In function 'int main()': a.cc:20:14: error: conflicting declaration 'std::vector<long long int> a' 20 | vector<ll> a(n), b(n); | ^ a.cc:18:12: note: previous declaration as 'll a' 18 | ll n, s, a; | ^ a.cc:22:9: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript 22 | in(a[i]); | ^ a.cc:11:22: note: in definition of macro 'in' 11 | #define in(n) cin >> n | ^ a.cc:23:8: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript 23 | b[a[i]]++; | ^
s869222893
p03846
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cmath> int main() { int N, ans, i; std::vector<int> vec; std::string str; std::cin >> N; for (i = 0; i < N; i++) { std::cin >> str; vec.push_back(std::stoi(str)); } std::sort(vec.begin(), vec.end()); if (N % 2 == 0) { for (i = 0; i < N; i += 2) { if ((vec.at(i) != i + 1) || (vec.at(i + 1) != i + 1)) { std::cout << 0; return 0; } } } else { if (vec.at(0) != 0) { std::cout << 0; return 0; } for (i = 1; i < N; i += 2) { if ((vec.at(i) != i + 1) || (vec.at(i + 1) != i + 1)) { std::cout << 0; return 0; } } } ans = std::pow(2, std::floor(N / 2)) % (std::pow(10, 9) + 7); std::cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:41:42: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 41 | ans = std::pow(2, std::floor(N / 2)) % (std::pow(10, 9) + 7); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~ | | | | | __gnu_cxx::__promote<double>::__type {aka double} | __gnu_cxx::__promote<double>::__type {aka double}
s698703692
p03846
Java
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] times = new int[n]; boolean isOdd = (n & 1) == 1; int num = 0; for(int i = 0; i < n; i++) { num = sc.nextInt(); if(isOdd && ((num & 1) == 1)) { System.out.println(0); return; } else if(!isOdd && ((num & 1) == 0)) { System.out.println(0); return; } times[num]++; if(times[num] > 2 || times[0] == 2) { System.out.println(0); return; } } long ans = 1; for(int i = 0; i < n/2; i++) ans = 2 * ans % 1000000007; System.out.println(modPow(2L, n / 2)); } static long modPow(long x, long n) { long res = 1L; while (n > 0) { if ((n & 1) == 1) { res = res * x % MOD; } x = x * x % MOD; n >>= 1; } return res; } }
Main.java:39: error: cannot find symbol res = res * x % MOD; ^ symbol: variable MOD location: class Main Main.java:41: error: cannot find symbol x = x * x % MOD; ^ symbol: variable MOD location: class Main 2 errors
s840426332
p03846
C++
#include <cstdio> #include <iostream> using namespace std ; const int P = 1000000007 ; int n ; int yes[500000] ; int base[500000] ; int expow(int a, int b){ int res = 1 ; while (b){ if (b & 1) res = 1ll * a * res % P ; a = 1ll * a * a % P ; b >>= 1 ; } return res ; } int main(){ cin >> n ; for (int i = 1 ; i <= n ; ++ i) scanf("%d", &base[i]) ; sort(base + 1, base + n + 1) ; if (n & 1){ yes[1] = 0 ; int cnt = 0 ; for (int i = 2 ; i <= n ; i += 2) yes[i] = yes[i + 1] = 2 * (++ cnt) ; for (int i = 1 ; i <= n ; ++ i) if (base[i] != yes[i]) return puts(""), 0 ; } else{ int cnt = 0 ; yes[1] = yes[2] = ++ cnt ; for (int i = 3 ; i <= n ; i += 2) yes[i] = yes[i + 1] = (cnt += 2) ; for (int i = 1 ; i <= n ; ++ i) if (base[i] != yes[i]) return puts(""), 0 ; } return printf("%d\n", expow(2, n / 2)), 0 ; }
a.cc: In function 'int main()': a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'? 24 | sort(base + 1, base + n + 1) ; | ^~~~ | short
s944066875
p03846
Java
import com.sun.javafx.logging.JFRInputEvent; import java.io.*; import java.util.*; class Main { static final int M = 1000000007; public static void main(String[] args) throws Exception { final Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; for (int i = 0; i < N; i++) { int p = sc.nextInt(); A[p]++; if (A[p] > 2) { System.out.println(0); return; } } if (N % 2 == 1) { if (A[0] != 1) { System.out.println(0); return; } } else if (A[0] != 0) { System.out.println(0); return; } for (int i = 1; i < A.length; i++) { if (A[i] == 1) { System.out.println(0); return; } } int a = 1; for (int i = 0; i < N / 2; i++) { a = a * 2 % M; } System.out.println(a); } }
Main.java:1: error: package com.sun.javafx.logging does not exist import com.sun.javafx.logging.JFRInputEvent; ^ 1 error
s437850552
p03846
C++
#include <iostream> #include <fstream> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main(int argc, const char * argv[]) // cinを高速にするためのおまじない cin.tie(0); ios::sync_with_stdio(false); long cnt = 0; cin >> cnt; int store[100000] = {0}; int error = false; for (int i=0; i<cnt; i++) { int num; cin >> num; store[num] = store[num] + 1; if (store[0] > 1) { error = true; break; } else if (store[num] > 2) { error = true; break; } } if (error) { cout << 0; return 0; } long n = (cnt/2); long a = pow(2, n); long b = pow(10, 9) + 7; long result = a % b; cout << result; return 0; }
a.cc:11:5: error: expected initializer before 'cin' 11 | cin.tie(0); | ^~~ a.cc:12:5: error: specializing member 'std::basic_ios<char>::sync_with_stdio' requires 'template<>' syntax 12 | ios::sync_with_stdio(false); | ^~~ a.cc:15:5: error: 'cin' does not name a type 15 | cin >> cnt; | ^~~ a.cc:20:5: error: expected unqualified-id before 'for' 20 | for (int i=0; i<cnt; i++) { | ^~~ a.cc:20:19: error: 'i' does not name a type 20 | for (int i=0; i<cnt; i++) { | ^ a.cc:20:26: error: 'i' does not name a type 20 | for (int i=0; i<cnt; i++) { | ^ a.cc:34:5: error: expected unqualified-id before 'if' 34 | if (error) { | ^~ a.cc:43:5: error: 'cout' does not name a type 43 | cout << result; | ^~~~ a.cc:45:5: error: expected unqualified-id before 'return' 45 | return 0; | ^~~~~~ a.cc:46:1: error: expected declaration before '}' token 46 | } | ^
s358881141
p03846
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; #define rep(i,n) for(int i=0; i<(n); i++) int a[100100]; int cnt[100100]; int main() { int n; cin >> n; rep(i,n) cin >> a[i]; rep(i,n) cnt[i]=0; rep(i,n) cnt[a[i]]++; if(n%2==0){ int limit = n-1; bool ok = true; int count = 0; while(limit>0){ if(cnt[limit]!=2) ok = false; limit -=2; count++; } if(!ok){ cout << 0 << endl; return 0; } else{ ll ans = pow(2,count)%1000000007; cout << ans << endl; return 0; } } else{ int limit=n-1; bool ok=true; int count=0; while(limit>=0){ if(limit>0 && cnt[limit]!=2) ok=false; else if(limit==0 && cnt[limit]!=1) ok=false; limit-=2; count++; } if(!ok){ cout << 0 << endl; return 0; } else{ ll ans = pow(2,count-1)%1000000007; cout << ans << endl; return 0; } } }
a.cc: In function 'int main()': a.cc:28:28: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 28 | ll ans = pow(2,count)%1000000007; | ~~~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double} a.cc:48:30: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 48 | ll ans = pow(2,count-1)%1000000007; | ~~~~~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s565594230
p03846
C++
#include <iostream> #include <cstdio> #include <string> #include <bits/stdc++.h> #include <set> #include <list> //list<???> a; a.push_back ,insert(追加したい要素),a.sort(),参照できない #include <vector> //vector<???> a; a.push_back,sort(a.begin(),a.end());a[i] //配列 int a[N];a[i]=追加したい要素;sort(a,a+N);a[i] const int MOD = 1e9+7; using namespace std; typedef long ll; #define rep(i,n) for(int i=0;i<(n);i++) //using namespace std; // int main(){ long long N;cin>>N; long long ans[1000000]; long long A,a=1,flag=0; for(long long i=0;i<N;i++){ cin>>A; ans[A]++; } if(N%2==1 && ans[0]==1){ for(long long i=2;i<N;i+=2){ if(ans[i]==2){ flag=1; (a=a*2) %= MOD; }else{ flag=0; break; } } }else if(N%2==0 && ans[1]==2){ for(long long i=1;i<N;i+=2){ if(ans[i]==2){ flag=1; (a=a*2) %= MOD; }else{ flag=0; break; } } }else{ flag=0; break; } if(flag==1){ cout<<a<<endl; }else{ cout<<0<<endl; } }
a.cc: In function 'int main()': a.cc:50:5: error: break statement not within loop or switch 50 | break; | ^~~~~
s921455854
p03846
C++
#include <iostream> #include <cstdio> #include <string> #include <bits/stdc++.h> #include <set> #include <list> //list<???> a; a.push_back ,insert(追加したい要素),a.sort(),参照できない #include <vector> //vector<???> a; a.push_back,sort(a.begin(),a.end());a[i] //配列 int a[N];a[i]=追加したい要素;sort(a,a+N);a[i] const int MOD = 1e9+7; using namespace std; typedef long ll; #define rep(i,n) for(int i=0;i<(n);i++) //using namespace std; // int main(){ int N;cin>>N; int a[N]; for(int i=0;i<N;i++){ int A;cin>>A; a[i]=A; } int flag=1; sort(a,a+N); for(int i=0;i<N-1;i++){ if(N%2==1 && a[0]==0){ if((i%2==0 && a[i]+2==a[i+1]) || (i%2==1 && a[i]==a[i+1]){ flag=1; }else{ flag=0; break; } }else if(N%2==0 && a[0]==1){ if((i%2==1 && a[i]+2==a[i+1]) || (i%2==0 && a[i]==a[i+1])){ flag=1; }else{ flag=0; break; } } } if(flag==1){ long long ans = pow(2,N/2); cout<<ans%MOD<<endl; }else{ cout<<0<<endl; } }
a.cc: In function 'int main()': a.cc:35:64: error: expected ')' before '{' token 35 | if((i%2==0 && a[i]+2==a[i+1]) || (i%2==1 && a[i]==a[i+1]){ | ~ ^ | ) a.cc:42:5: error: expected primary-expression before '}' token 42 | }else if(N%2==0 && a[0]==1){ | ^
s741281406
p03846
C++
#include <iostream> #include <cstdio> #include <string> #include <bits/stdc++.h> #include <set> #include <list> //list<???> a; a.push_back ,insert(追加したい要素),a.sort(),参照できない #include <vector> //vector<???> a; a.push_back,sort(a.begin(),a.end());a[i] //配列 int a[N];a[i]=追加したい要素;sort(a,a+N);a[i] using namespace std; typedef long ll; #define rep(i,n) for(int i=0;i<(n);i++) //using namespace std; // int main(){ int N;cin>>N; int a[N]; for(int i=0;i<N;i++){ int A;cin>>A; a[i]=A; } int flag=1; sort(a,a+N); for(int i=0;i<N-1;i++){ if(N%2==1 && a[0]==0){ if((i%2==0 && a[i]+2==a[i+1]) || i%2==1){ flag=1; }else{ flag=0; break; } }else if(N%2==0 && a[0]==1){ if((i%2==1 && a[i]+2==a[i+1]) || i%2==0){ flag=1; }else{ flag=0; break; } }else{ flag=0; break; } } if(flag==1){ cout<<(N/2)*(N/2)<<endl; }else{ cout<<0<<endl; }
a.cc: In function 'int main()': a.cc:57:4: error: expected '}' at end of input 57 | } | ^ a.cc:18:11: note: to match this '{' 18 | int main(){ | ^
s318762372
p03846
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll INF= 1LL << 60; #define REP(i,n) for(ll i=0; i<n; i++) #define FOR(i,a,n) for(ll i=a; i<n; i++) #define tl 1'000'000'009 int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vector<ll>A(n); map<ll,ll>p; REP(i,n){ cin >> A[i]; p[A[i]]++; if(p[A[i]]>1) A[i]*= -1; } sort(A.begin(), A.end()); // REP(i,n) cout << A[i] << endl; ll cc= -(n-1); int flag= 1; REP(i,n){ if(A[i]!=cc) flag=0; cc+= 2; } cout << (powl(2,n/2)*flag)%tl << endl; }
a.cc: In function 'int main()': a.cc:28:31: error: invalid operands of types 'long double' and 'int' to binary 'operator%' 28 | cout << (powl(2,n/2)*flag)%tl << endl; | ~~~~~~~~~~~~~~~~~~^ | | | long double
s594347076
p03846
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll INF= 1LL << 60; #define REP(i,n) for(ll i=0; i<n; i++) #define FOR(i,a,n) for(ll i=a; i<n; i++) #define tl 1'000'000'009 int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int>A(n); map<int,int>p; REP(i,n){ cin >> A[i]; p[A[i]]++; if(p[A[i]]>1) A[i]*= -1; } sort(A.begin(), A.end()); // REP(i,n) cout << A[i] << endl; ll cc= -(n-1); int flag= 1; REP(i,n){ if(A[i]!=cc) flag=0; cc+= 2; } cout << ((flag)?powl(2,n/2):0)%tl << endl; }
a.cc: In function 'int main()': a.cc:28:35: error: invalid operands of types 'long double' and 'int' to binary 'operator%' 28 | cout << ((flag)?powl(2,n/2):0)%tl << endl; | ~~~~~~~~~~~~~~~~~~~~~~^ | | | long double
s133799252
p03846
C++
#include<bits/stdc++.h> #include<numeric> using namespace std; #define ll long long #define mp make_pair #define fi first #define se second #define pii pair<ll,ll> #define pb push_back #define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define what_is(x) cerr << #x << " is " << x << endl; int main() { ll int n,ans; int flag=1; cin >> n; // if(n==0) // cout << 0; std::vector<int>A(n); for(int i=0;i<n;i++) cin >> A[i]; // if(n==0&&A[0]) sort(A.begin(),A.end()); if(n%2) { if(A[0]!=0) {flag=0;break;} for(int i=1;i<n;i+=2) { if(!(A[i]==A[i+1]&&A[i]==(i+1))) {flag=0;break;} } n /=2; ans = pow(2,n); } else { for(int i=0;i<n;i+=2) { if(!(A[i]==A[i+1]&&A[i]==(i+1))) {flag = 0;break;} } n /=2; ans = pow(2,n); } if(flag) cout << ans; else cout << 0; }
a.cc: In function 'int main()': a.cc:27:17: error: break statement not within loop or switch 27 | {flag=0;break;} | ^~~~~
s276559987
p03846
C++
#include <iostream> #include <algorithm> #include <cstring> #include <string> #include <cmath> #define ll long long ll MOD=1e9+7; ll a[100005]; using namespace std; int main(){ ll n; cin>>n; ll flag=1;//flag ll ans=1; if(n%2==0){ // even number for(ll i=0;i<n;i++){ ll x; cin>>x; a[x]++;//a[7]++ / / give data x error if(x>=n || x%2==0 || a[x]>2){ flag=0; cout<<"0"<<endl; break; } //The correct situation if(a[x]==1) ans=ans*2%MOD; // a * b %c == a%c * b%c } } else{ //odd for(ll i=0;i<n;i++){ ll x; cin>>x; a[x]++; / / give data x error if(x>=n || x%2==1 || a[0]>1 ||a[x]>2){ flag=0; cout<<"0"<<endl; break; } //The correct situation if(x!=0 && a[x]==1) ans=ans*2%MOD; } } if(flag) cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:26:25: error: expected primary-expression before '/' token 26 | / / give data x error | ^ a.cc:26:27: error: expected primary-expression before '/' token 26 | / / give data x error | ^ a.cc:26:29: error: 'give' was not declared in this scope 26 | / / give data x error | ^~~~ a.cc:46:25: error: expected primary-expression before '/' token 46 | / / give data x error | ^ a.cc:46:27: error: expected primary-expression before '/' token 46 | / / give data x error | ^ a.cc:46:29: error: 'give' was not declared in this scope 46 | / / give data x error | ^~~~
s402862037
p03846
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <cmath> #include <climits> using namespace std; bool comp(pair<int, string> a, pair<int, string> b){ if(a.first != b.first) return a.first > b.first; else return a.second < b.second; } int main(){ vector<long int> v; long int n; cin >> n; for(long int i = 0; i < n; ++i){ long int a; cin >> a; v.push_back(a); } sort(v.begin(),v.end()); if(n % 2 == 1){ if(v[0] != 0){ cout << 0 << endl; return 0; } for(long int i = 1;i < n; i += 2){ if(v[i] != v[i + 1]){ cout << 0 << endl; return 0; } } cout << pow(2,n/2)%((int)pow(10,9) + 7) << endl; }else{ for(int i = 0;i < n; i += 2){ if(v[i] != v[i + 1]){ cout << 0 << endl; return 0; } } cout << pow(2,n/2)%((int)pow(10,9) + 7) << endl; } }
a.cc: In function 'int main()': a.cc:41:27: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 41 | cout << pow(2,n/2)%((int)pow(10,9) + 7) << endl; | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double} a.cc:49:27: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 49 | cout << pow(2,n/2)%((int)pow(10,9) + 7) << endl; | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s915395199
p03846
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <cmath> #include <climits> using namespace std; bool comp(pair<int, string> a, pair<int, string> b){ if(a.first != b.first) return a.first > b.first; else return a.second < b.second; } int main(){ vector<long int> v; long int n; cin >> n; for(long int i = 0; i < n; ++i){ long int a; cin >> a; v.push_back(a); } sort(v.begin(),v.end()); if(n % 2 == 1){ if(v[0] != 0){ cout << 0 << endl; return 0; } for(long int i = 1;i < n; i += 2){ if(v[i] != v[i + 1]){ cout << 0 << endl; return 0; } } cout << << endl; }else{ for(int i = 0;i < n; i += 2){ if(v[i] != v[i + 1]){ cout << 0 << endl; return 0; } } cout << pow(2,n/2)%((int)pow(10,9) + 7) << endl; } }
a.cc: In function 'int main()': a.cc:41:18: error: expected primary-expression before '<<' token 41 | cout << << endl; | ^~ a.cc:49:27: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 49 | cout << pow(2,n/2)%((int)pow(10,9) + 7) << endl; | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s481615891
p03846
C++
#include <bits/stdc++.h> using namespace std; long long MOD = 1E9+7; int main(){ int n; cin >> n; int a[n],b[n]={}; for(int i=0;i<n;i++){ cin >> a[i]; b[a[i]/2]++; } for(int i=0;i<(n+1)/2;i++){ if(n%2){ if(b[0]!=1) cout << 0 << endl; return 0; } else{ if(b[i]!=2){ cout << 0 << endl; return 0; } } } for(int i=1;i<=n/2;i++)c = (2*c)%MOD; cout << c << endl; }
a.cc: In function 'int main()': a.cc:24:26: error: 'c' was not declared in this scope 24 | for(int i=1;i<=n/2;i++)c = (2*c)%MOD; | ^ a.cc:25:11: error: 'c' was not declared in this scope 25 | cout << c << endl; | ^
s811386608
p03846
C++
#include<bits/stdc++.h> using namespace std; #define ll long long #define ff(i,a,b) for(i=a;i<=b;i++) #define fb(i,a,b) for(i=a;i>=b;i--) #define fast ios_base::sync_with_stdio(false);cin.tie(NULL) #define 1000000007 int main() { fast; ll n,i,total=0; bool ans=false; cin>>n; ll a[n+1]; unordered_map<ll,ll> m; ff(i,1,n) { cin>>a[i]; if(n & 1) { if(a[i] & 1) ans=true; } else { if(a[i]%2==0) ans=true; } if(a[i]>=n) ans=true; m[a[i]]++; } for(auto x : m) { if(n & 1) { if(m[0]!=1) { ans=true; break; } else if(x.second!=2 && x.first!=0) { ans=true; break; } } else { if(x.second!=2) { ans=true; break; } } } if(ans) { cout<<"0"<<endl; } else { if(n & 1) { total=(long long)(pow(2,n/2)%m); cout<<total%m<<endl; } else { total=(long long)(pow(2,n/2)%m); cout<<total%m<<endl; } } return 0; }
a.cc:7:9: error: macro names must be identifiers 7 | #define 1000000007 | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:66:41: error: no match for 'operator%' (operand types are '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'std::unordered_map<long long int, long long int>') 66 | total=(long long)(pow(2,n/2)%m); | ~~~~~~~~~~^~ | | | | | std::unordered_map<long long int, long long int> | __gnu_cxx::__promote<double>::__type {aka double} In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:66:42: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} 66 | total=(long long)(pow(2,n/2)%m); | ^ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:66:42: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} 66 | total=(long long)(pow(2,n/2)%m); | ^ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:66:42: note: 'std::unordered_map<long long int, long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 66 | total=(long long)(pow(2,n/2)%m); | ^ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:66:42: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} 66 | total=(long long)(pow(2,n/2)%m); | ^ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:66:42: note: 'std::unordered_map<long long int, long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 66 | total=(long long)(pow(2,n/2)%m); | ^ /usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const valarray<_Tp>&, const valarray<_Tp>&)' 1200 | _DEFINE_BINARY_OPERATOR(%, __modulus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed: a.cc:66:42: note: mismatched types 'const std::valarray<_Tp>' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} 66 | total=(long long)(pow(2,n/2)%m); | ^ /usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1200 | _DEFINE_BINARY_OPERATOR(%, __modulus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed: a.cc:66:42: note: mismatched types 'const std::valarray<_Tp>' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} 66 | total=(long long)(pow(2,n/2)%m); | ^ /usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1200 | _DEFINE_BINARY_OPERATOR(%, __modulus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed: a.cc:66:42: note: 'std::unordered_map<long long int, long long int>' is not derived from 'const std::valarray<_Tp>' 66 | total=(long long)(pow(2,n/2)%m); | ^ a.cc:67:24: error: no match for 'operator%' (operand types are 'long long int' and 'std::unordered_map<long long int, long long int>') 67 | cout<<total%m<<endl; | ~~~~~^~ | | | | | std::unordered_map<long long int, long long int> | long long int /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:67:25: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int' 67 | cout<<total%m<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:67:25: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int' 67 | cout<<total%m<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:67:25: note: 'std::unordered_map<long long int, long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 67 | cout<<total%m<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<t
s864436352
p03846
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long int N,ans=2; bool flag = true; cin >> N; vector<int> A(N/2 +1,0); for(int i=0;i<N;i++){ int a; cin >> a; if(N%2==0){ if(a%2==0){ flag = false; } }else{ if(a%2==1){ flag = false; } } A[a/2]++; } if(N%2==1){ for(int i=1;i<N/2+1;i++){ if(A[0]!=1 || A[i] != 2){ flag = false; } } }else{ for(int i=0;i<N/2;i++){ if(A[i] != 2){ flag = false; } } } for(int i=0;i<N/2-1;i++){ ans *= 2; ans %= 1000000007; } if(flag){ cout << pow(2,N/2)%1000000007 << endl; }else{ cout << "0" << endl; } }
a.cc: In function 'int main()': a.cc:47:27: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 47 | cout << pow(2,N/2)%1000000007 << endl; | ~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s473222122
p03846
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long int N; bool flag = true; cin >> N; vector<int> A(N/2 +1,0); for(int i=0;i<N;i++){ int a; cin >> a; if(N%2==0){ if(a%2==0){ flag = false; } }else{ if(a%2==1){ flag = false; } } A[a/2]++; } if(N%2==1){ for(int i=1;i<N/2+1;i++){ if(A[0]!=1 || A[i] != 2){ flag = false; } } }else{ for(int i=0;i<N/2;i++){ if(A[i] != 2){ flag = false; } } } if(flag){ cout << pow(2,N/2)%1000000007 << endl; }else{ cout << "0" << endl; } }
a.cc: In function 'int main()': a.cc:42:27: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 42 | cout << pow(2,N/2)%1000000007 << endl; | ~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s403427673
p03846
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define REP(i,s,n) for(int i=(s);i<(n);i++) #define repr(i,n) for(int i=n-1;i>=0;i--) #define REPR(i,s,n) for(int i=(s);i>=(n);i--) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define Eunique(v) v.erase(unique(all(v)),v.end()) #define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl; #define pb push_back #define pf push_front #define mod 1e9+7 #define m_p make_pair typedef vector<int> vi; typedef vector<string> vs; typedef long long ll; typedef vector<ll> vll; typedef pair<int,int> pii; typedef vector<pii> vpii; typedef pair<ll,ll> pll; typedef vector<pll> vpll; typedef vector<vector<int>> vvi; typedef vector<vector<ll>> vvll; const double pi = acos(-1.0); ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); } ll lcm(ll x, ll y) { return x * y / gcd(x, y); } bool IsPrime(int num) { if (num < 2) return false; else if (num == 2) return true; else if (num % 2 == 0) return false; double sqrtNum = sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { return false; } } return true; } int main() { ll n; bool b=true; map<ll,ll> mp; cin >> n; vll a(n); rep(i,n){ cin >> a[i]; mp[a[i]]++; } if(n%2==0){ rep(i,n/2){ if(mp[i*2+1]!=2) b=false; } } else{ if(mp[0]!=1) b=false; rep(i,n/2){ if(mp[(i+1)*2]!=2) b=false; } } cout << (b?pow(2,n/2)%1000000007:0) << endl; return 0; }
a.cc: In function 'int main()': a.cc:71:26: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 71 | cout << (b?pow(2,n/2)%1000000007:0) << endl; | ~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s508185961
p03846
C++
#include<iostream> #include<numeric> #include<algorithm> using namespace std; int main() { int n; cin >> n; int a[100000]; for (int i = 0; i < n;i++) cin >> a[i]; int c = count(a, a + n, 0); if (n % 2 == 0 && c > 0 || n % 2 != 0 && c> 1) cout << "0"; else { for (int i = 0; i < n;i++) { if (count(a, a + n, a[i]) > 2) { cout << "0"; return(0); } } if (n % 2 == 0) cout << (n * 2)%((int)pow(10,9) + 7); else cout << (n - 1) % ((int)pow(10, 9) + 7); } return 0; }
a.cc: In function 'int main()': a.cc:26:47: error: 'pow' was not declared in this scope 26 | cout << (n * 2)%((int)pow(10,9) + 7); | ^~~ a.cc:28:49: error: 'pow' was not declared in this scope 28 | cout << (n - 1) % ((int)pow(10, 9) + 7); | ^~~
s299860349
p03846
C++
#include<iostream> #include<numeric> using namespace std; int main() { int n; cin >> n; int a[100000]; for (int i = 0; i < n;i++) cin >> a[i]; int c = count(a, a + n, 0); if (n % 2 == 0 && c > 0 || n % 2 != 0 && c> 1) cout << "0"; else { if (n % 2 == 0) cout << n * 2; else cout << n - 1; } return 0; }
a.cc: In function 'int main()': a.cc:11:17: error: 'count' was not declared in this scope 11 | int c = count(a, a + n, 0); | ^~~~~
s316095663
p03846
C++
#include<iostream> #include<numeric> using namespace std; int main() { int n; cin >> n; int a[100000]; for (int i = 0; i < n;i++) cin >> a[i]; if (n % 2 == 0 && count(a, a + n, 0) > 0 || n % 2 != 0 && count(a, a + n, 0) > 1) cout << "0"; else { if (n % 2 == 0) cout << n * 2; else cout << n - 1; } return 0; }
a.cc: In function 'int main()': a.cc:11:27: error: 'count' was not declared in this scope 11 | if (n % 2 == 0 && count(a, a + n, 0) > 0 || n % 2 != 0 && count(a, a + n, 0) > 1) | ^~~~~
s669158927
p03846
C++
#include <iostream> #include <vector> #include <map> using namespace std; long long int D = 1000000007; int main(){ int N; vector<int> a(N); for(int i = 0; i < N; i++) cin >> a[i]; bool coh = true; long long int ans = 0LL; for(int i = 0; i < N; i++){ if(a[i] < 0 || a[i] > N-1){ coh = false; break; } } map<int, int> m; for(int i = 0; i < N; i++) m[a[i]]++; for(auto iter = m.begin(); iter != m.end(); iter++){ if(iter->second != 2) coh = false; ans = (ans * 2) % D; } }else{ for(auto iter = m.begin(); iter != m.end(); iter++){ if(iter->second != 2){ if(iter->first == 0 && iter->second == 1){ ans = (ans * 2) % D; }else{ coh = false; } }else{ ans = (ans * 2) % D; } } } if(coh) cout << ans; else cout << 0; }
a.cc:31:4: error: expected unqualified-id before 'else' 31 | }else{ | ^~~~ a.cc:44:3: error: expected unqualified-id before 'if' 44 | if(coh) cout << ans; | ^~ a.cc:45:3: error: expected unqualified-id before 'else' 45 | else cout << 0; | ^~~~ a.cc:46:1: error: expected declaration before '}' token 46 | } | ^
s210590356
p03846
C++
#include <iostream> #include <vector> #include <map> using namespace std; long long int D = 1000000007; int main(){ int N; vector<int> a(N); for(int i = 0; i < N; i++) cin >> a[i]; bool coh = true; long long int ans = 0LL; for(int i = 0; i < N; i++){ if(a[i] < 0 || a[i] > N-1){ coh = false; break; } } map<int, int> m; for(int i = 0; i < N; i++) m[a[i]]++; if(N for(auto iter = m.begin(); iter != m.end(); iter++){ if(iter->second != 2) coh = false; ans = (ans * 2) % D; } }else{ for(auto iter = m.begin(); iter != m.end(); iter++){ if(iter->second != 2){ if(iter->first == 0 && iter->second == 1){ ans = (ans * 2) % D; }else{ coh = false; } }else{ ans = (ans * 2) % D; } } } if(coh) cout << ans; else cout << 0; }
a.cc: In function 'int main()': a.cc:27:7: error: expected ')' before 'for' 27 | if(N | ~ ^ | ) 28 | for(auto iter = m.begin(); iter != m.end(); iter++){ | ~~~ a.cc:28:32: error: 'iter' was not declared in this scope 28 | for(auto iter = m.begin(); iter != m.end(); iter++){ | ^~~~ a.cc: At global scope: a.cc:32:4: error: expected unqualified-id before 'else' 32 | }else{ | ^~~~ a.cc:45:3: error: expected unqualified-id before 'if' 45 | if(coh) cout << ans; | ^~ a.cc:46:3: error: expected unqualified-id before 'else' 46 | else cout << 0; | ^~~~ a.cc:47:1: error: expected declaration before '}' token 47 | } | ^
s058136940
p03846
C++
#include <iostream> #include <vector> #include <map> using namespace std; long long int D = 1000000007; int main(){ int N; vector<int> a(N); for(int i = 0; i < N; i++) cin >> a[i]; bool coh = true; long long int ans = 0LL; for(int i = 0; i < N; i++){ if(a[i] < 0 || a[i] > N-1){ coh = false; break; } } map<int, int> m; for(int i = 0; i < N; i++) m[a[i]]++; if(N for(auto iter = m.begin(); iter != m.end(); iter++){ if(iter->second != 2) coh = false; ans = (ans * 2) % D; } }else{ for(auto iter = m.begin(); iter != m.end(); iter++){ if(iter->second != 2){ if(iter->first == 0 && iter->second == 1){ ans = (ans * 2) % D; }else coh = false; }else{ ans = (ans * 2) % D; } } } if(coh) cout << ans; else cout << 0; }
a.cc: In function 'int main()': a.cc:27:7: error: expected ')' before 'for' 27 | if(N | ~ ^ | ) 28 | for(auto iter = m.begin(); iter != m.end(); iter++){ | ~~~ a.cc:28:32: error: 'iter' was not declared in this scope 28 | for(auto iter = m.begin(); iter != m.end(); iter++){ | ^~~~ a.cc: At global scope: a.cc:32:4: error: expected unqualified-id before 'else' 32 | }else{ | ^~~~ a.cc:43:3: error: expected unqualified-id before 'if' 43 | if(coh) cout << ans; | ^~ a.cc:44:3: error: expected unqualified-id before 'else' 44 | else cout << 0; | ^~~~ a.cc:45:1: error: expected declaration before '}' token 45 | } | ^
s041033482
p03846
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <ctype.h> #include <stdint.h> #include <string.h> #include <wchar.h> #include <math.h> #define N_MAX (100) #define P_MAX (100) #define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define ABS(a) ((a) < 0 ? -(a) : (a)) #define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a)) #define SWAP(type, a, b) { const type tmp = a; a = b; b = tmp; } int compare_sz_asc(const void* a, const void* b) { return *((size_t*)a) < *((size_t*)b) ? -1 : 1; } int compare_sz_desc(const void* a, const void* b) { return *((size_t*)a) > * ((size_t*)b) ? -1 : 1; } int compare_i64_asc(const void* a, const void* b) { return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1; } int compare_i64_desc(const void* a, const void* b) { return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1; } int compare_u64_asc(const void* a, const void* b) { return *((uint64_t*)a) < *((uint64_t*)b) ? -1 : 1; } int compare_u64_desc(const void* a, const void* b) { return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1; } int compare_c_asc(const void* a, const void* b) { return *((char*)a) < *((char*)b) ? -1 : 1; } int compare_c_desc(const void* a, const void* b) { return *((char*)a) > * ((char*)b) ? -1 : 1; } int compare_dp_asc(const void* a, const void* b) { return *((double*)a) < *((double*)b) ? -1 : 1; } static uint64_t modinvU64(const uint64_t a, const uint64_t m) { int64_t aa = (int64_t)a; const int64_t mm = (int64_t)m; int64_t b = mm; int64_t u = 1; int64_t v = 0; while (b != 0) { const int64_t t = aa / b; aa -= t * b; SWAP(uint64_t, aa, b); u -= t * v; SWAP(uint64_t, u, v); } u %= mm; if (u < 0) { u += m; } return (uint64_t)u; } static size_t powSz(const size_t base, const size_t exp) { if (exp == 0) { return 1; } if (exp == 1) { return base; } if (exp % 2 == 0) { return powSz(base * base, exp / 2); } else { return base * powSz(base, exp - 1); } } static uint64_t powU64(const uint64_t base, const uint64_t exp) { if (exp == 0) { return 1; } if (exp == 1) { return base; } if (exp % 2 == 0) { return powU64(base * base, exp / 2); } else { return base * powU64(base, exp - 1); } } static uint64_t powU64WMod(const uint64_t base, const uint64_t exp, const uint64_t m) { if (exp == 0) { return 1; } if (exp == 1) { return base % m; } if (exp % 2 == 0) { return powU64(base * base % m, exp / 2); } else { return base * powU64(base, exp - 1) % m; } } static size_t comb(const size_t n, const size_t r) { size_t result = 1; for (size_t i = 0; i < r; i++) { result *= n - i; result /= i + 1; } return result; } static uint64_t combU64(const uint64_t n, const uint64_t r) { uint64_t result = 1; for (uint64_t i = 0; i < r; i++) { result *= n - i; result /= i + 1; } return result; } static uint64_t combU64WMod(const uint64_t n, const uint64_t r, const uint64_t m) { uint64_t result = 1; for (uint64_t i = 0; i < r; i++) { result = result * (n - i) % m; result = result * modinvU64(i + 1, m) % m; } return result; } static uint64_t permU64WMod(const uint64_t n, const uint64_t m) { uint64_t result = 1; for (uint64_t v = 2; v <= n; v++) { result *= v; result %= m; } return result; } static size_t gcdZu(size_t m, size_t n) { size_t temp; while (m % n != 0) { temp = n; n = m % n; m = temp; } return n; } static uint64_t gcdU64(uint64_t m, uint64_t n) { uint64_t temp; while (m % n != 0) { temp = n; n = m % n; m = temp; } return n; } typedef struct { uint64_t val; }BHeap_Val; #define BHEAP_VAL_TYPE BHeap_Val #define BHEAP_INVALID_NODE ((size_t)100000000) typedef struct { BHEAP_VAL_TYPE val; } BHeap_Node; struct _BHeap_Ctx { size_t size; int (*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node); void(*notifyNodeChange)(const struct _BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList); BHeap_Node* node; }; typedef struct _BHeap_Ctx BHeap_Ctx; static void bHeap_Init(BHeap_Ctx* const ctx, int(*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node), void(*notifyNodeChange)(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList), BHeap_Node* const nodes) { ctx->size = 0; ctx->compare = compare; ctx->notifyNodeChange = notifyNodeChange; ctx->node = nodes; } static void bHeap_Swap(BHeap_Ctx* const ctx, const size_t node0, const size_t node1) { const BHEAP_VAL_TYPE tmp = ctx->node[node0].val; ctx->node[node0].val = ctx->node[node1].val; ctx->node[node1].val = tmp; if (ctx->notifyNodeChange != NULL) { const size_t nodeList[2] = { node0,node1 }; ctx->notifyNodeChange(ctx, 2, nodeList); } } static void bHeap_UpHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) { if (nodeIdx == 0) { return; } const size_t parentIdx = (nodeIdx + 1) / 2 - 1; const int compareResult = ctx->compare(&(ctx->node[parentIdx].val), &(ctx->node[nodeIdx].val)); if (0 < compareResult) { bHeap_Swap(ctx, nodeIdx, parentIdx); if (parentIdx != 0) { bHeap_UpHeap(ctx, parentIdx); } } } static void bHeap_DownHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) { if (ctx->size - 1 <= nodeIdx) { return; } const size_t leftIdx = 2 * (nodeIdx + 1) - 1; if (leftIdx < ctx->size) { const int leftResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[leftIdx].val)); size_t swapTarget = leftResult < 0 ? BHEAP_INVALID_NODE : leftIdx; const size_t rightIdx = leftIdx + 1; if (rightIdx < ctx->size) { const int rightResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[rightIdx].val)); if (swapTarget == BHEAP_INVALID_NODE) { if (0 < rightResult) { swapTarget = rightIdx; } } else { if (0 < rightResult) { const int rightLeftResult = ctx->compare(&(ctx->node[leftIdx].val), &(ctx->node[rightIdx].val)); if (0 < rightLeftResult) { swapTarget = rightIdx; } } } } if (swapTarget != BHEAP_INVALID_NODE) { bHeap_Swap(ctx, nodeIdx, swapTarget); bHeap_DownHeap(ctx, swapTarget); } } } static void bHeap_Add(BHeap_Ctx* const ctx, const BHEAP_VAL_TYPE val) { ctx->node[ctx->size].val = val; ctx->size++; if (ctx->notifyNodeChange != NULL) { const size_t node = ctx->size - 1; ctx->notifyNodeChange(ctx, 1, &node); } bHeap_UpHeap(ctx, ctx->size - 1); } static void bHeap_RemoveTop(BHeap_Ctx* const ctx) { if (ctx->size == 0) { return; } if (ctx->size == 1) { ctx->size--; return; } ctx->node[0].val = ctx->node[ctx->size - 1].val; if (ctx->notifyNodeChange != NULL) { const size_t node = 0; ctx->notifyNodeChange(ctx, 1, &node); } ctx->size--; bHeap_DownHeap(ctx, 0); } static void bHeap_RemoveNode(BHeap_Ctx* const ctx, const size_t node) { if (node == ctx->size - 1) { ctx->size--; } else { ctx->node[node].val = ctx->node[ctx->size - 1].val; ctx->size--; if (ctx->notifyNodeChange != NULL) { ctx->notifyNodeChange(ctx, 1, &node); } bHeap_DownHeap(ctx, node); bHeap_UpHeap(ctx, node); } } static BHEAP_VAL_TYPE* bHeap_GetTopVal(const BHeap_Ctx* const ctx) { return ctx->size == 0 ? NULL : &(ctx->node[0].val); } typedef struct { uint64_t cnt; size_t* child; size_t numChild; size_t maxNumChild; } Tree_Node; #define TREE_INIT_ALLOC (128) static Tree_Node tree_Node[200000]; static void tree_Init(const uint64_t N) { for (uint64_t i = 0; i < N; i++) { tree_Node[i].cnt = 0; tree_Node[i].numChild = 0; tree_Node[i].child = malloc(sizeof(size_t) * TREE_INIT_ALLOC); tree_Node[i].maxNumChild = TREE_INIT_ALLOC; } } static void tree_AddChild(const size_t parent, const size_t child) { if (tree_Node[parent].maxNumChild <= tree_Node[parent].numChild) { tree_Node[parent].child = realloc(tree_Node[parent].child, sizeof(size_t) * tree_Node[parent].maxNumChild * 2); tree_Node[parent].maxNumChild *= 2; } tree_Node[parent].child[tree_Node[parent].numChild] = child; tree_Node[parent].numChild++; } static BHeap_Node BN_Asc[200000]; static BHeap_Node BN_Desc[200000]; static int _bHeap_Compare_Asc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) { return parent->val <= node->val ? -1 : 1; } static int _bHeap_Compare_Desc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) { return parent->val >= node->val ? -1 : 1; } static size_t PBHeap_Asc_Idx[200000]; static size_t PBHeap_Desc_Idx[200000]; static void _bHeap_NotifyNodeChange_Asc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) { for (size_t i = 0; i < nodeListSize; i++) { PBHeap_Asc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i]; } } static void _bHeap_NotifyNodeChange_Desc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) { for (size_t i = 0; i < nodeListSize; i++) { PBHeap_Desc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i]; } } #define MOD_VAL (UINT64_C(1000000007)) static size_t cnt[100000]; int main(void) { uint64_t N; scanf("%"PRIu64, &N); for (uint64_t i = 0; i < N; i++) { cnt[i] = 0; } for (uint64_t i = 0; i < N; i++) { uint64_t A; scanf("%"PRIu64, &A); cnt[A]++; } if (N % 2 == 0) { for (uint64_t i = 0; i < N; i++) { if (i % 2 == 0) { if (cnt[i] != 0) { puts("0"); return 0; } } else { if (cnt[i] != 2) { puts("0"); return 0; } } } } else { for (uint64_t i = 0; i < N; i++) { if (i == 0) { if (cnt[i] != 1) { puts("0"); return 0; } } else if (i % 2 == 0) { if (cnt[i] != 2) { puts("0"); return 0; } } else { if (cnt[i] != 0) { puts("0"); return 0; } } } } printf("%"PRIu64"\n", powU64WMod(2, N / 2)); return 0; }
main.c: In function 'main': main.c:472:27: error: too few arguments to function 'powU64WMod' 472 | printf("%"PRIu64"\n", powU64WMod(2, N / 2)); | ^~~~~~~~~~ main.c:115:17: note: declared here 115 | static uint64_t powU64WMod(const uint64_t base, const uint64_t exp, const uint64_t m) { | ^~~~~~~~~~
s158718272
p03846
C++
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) #define REPR(i, n) for(int i = n; i >= 0; i--) #define FOR(i, m, n) for(int i = m; i < n; i++) #define INF 1e9 #define ALL(v) v.begin(), v.end() typedef long long ll; #define downque(que) priority_queue<ll> que; #define upque(que) priority_queue<ll, vector<int>, greater<int>> que; int main(){ int n; cin>>n; vector<int> a(n); bool check=true; REP(i,n)cin>>a[i]; sort(ALL(a)); ll ans =0; if(n%2==0){ for(int i=0;i<n-1;i+=2){ if(a[i]!=i+1||a[i]!=a[i+1]){ check=false; break; } } }else{ if(a[0]!=0)check=false; for(int i=1;i<n-1;i+=2){ if(a[i]!=i+1||a[i]!=a[i+1]){ check=false; break; } } } if(check){ if(n%2==0)ans=pow(2,n/2); else ans=pow(2,(n-1)/2); ans%(1e9+7); cout<<ans<<endl; }else cout<<0<<endl; }
a.cc: In function 'int main()': a.cc:41:6: error: invalid operands of types 'll' {aka 'long long int'} and 'double' to binary 'operator%' 41 | ans%(1e9+7); | ~~~^~~~~~~~ | | | | | double | ll {aka long long int}
s271559672
p03846
Java
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> number(100100); for (int i = 0; i < N; i++) { int a; cin >> a; number[a]++; } int mod = 1000000000 + 7; bool valid = true; if (N % 2 != 0) { if (number[0] != 1) { valid = false; } else { for (int i = 1; i < N; i++) { if (i % 2 == 0) { if (number[i] != 2) { valid = false; break; } } else { if (number[i] != 0) { valid = false; break; } } } } } else { if (number[0] != 0) { valid = false; } else { for (int i = 1; i < N; i++) { if (i % 2 == 0) { if (number[i] != 0) { valid = false; break; } } else { if (number[i] != 2) { valid = false; break; } } } } } if (valid){ int count = 1; for (int i = 1; i <= N / 2; i++) { count = (count * 2) % mod; } cout << count << endl; } else { cout << 0 << endl; } }
Main.java:1: error: illegal character: '#' #include <bits/stdc++.h> ^ Main.java:1: error: class, interface, enum, or record expected #include <bits/stdc++.h> ^ Main.java:7: error: not a statement cin >> N; ^ Main.java:12: error: not a statement cin >> a; ^ Main.java:66: error: not a statement cout << count << endl; ^ Main.java:70: error: not a statement cout << 0 << endl; ^ Main.java:4: error: unnamed classes are a preview feature and are disabled by default. int main() { ^ (use --enable-preview to enable unnamed classes) Main.java:9: error: ';' expected vector<int> number(100100); ^ 8 errors
s810302354
p03846
C++
#include <iostream> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main(){ int N; cin>>N; vector<int>A(N); for (int i=0;i<N;++i){ cin>>A[i]; } bool Flag=true; long long ans=0; long long MOD=1000000007; if (N%2==0){ for (int i=0;i<N;++i){ if (A[i]%2==0){ Flag=false; break; } break; } for (int i=1;i<(N+1)/2;i+=2){ if (count(A.begin(), A.end(),i)!=2){ Flag=false; break; } } if (Flag){ ans=N/2; ans=pow(2,ans)%MOD; cout<<ans<<endl; } } if (N%2==1){ for (int i=0;i<N;++i){ if (A[i]%2==1){ Flag=false; break; } break; } for (int i=2;i<(N+1)/2;i+=2){ if (count(A.begin(), A.end(),0)!=1){ Flag=false; break; } else if (count(A.begin(), A.end(),i)!=2){ Flag=false; break; } } if (Flag){ ans=(N-1)/2; ans=pow(2,ans)%MOD; cout<<ans<<endl; } } if (!Flag){ cout<<"0"<<endl; } }
a.cc: In function 'int main()': a.cc:33:21: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%' 33 | ans=pow(2,ans)%MOD; | ~~~~~~~~~~^~~~ | | | | | long long int | __gnu_cxx::__promote<double>::__type {aka double} a.cc:58:21: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%' 58 | ans=pow(2,ans)%MOD; | ~~~~~~~~~~^~~~ | | | | | long long int | __gnu_cxx::__promote<double>::__type {aka double}
s062985255
p03846
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int N;cin>>N; vector<int>A(N); for (int i=0;i<N;++i){ cin>>A[i]; } bool Flag=true; long long ans=0; long long MOD=1000000009; if (N%2==0){ for (int i=0;i<N;++i){ if (A[i]%2==0){ Flag=false; break; } break; } for (int i=1;i<(N+1);i+=2) if (count(A.begin(), A.end(),i)!=2){ break; } } ans=(N/2)*(N/2); cout<<ans%MOD<<endl; else{ for (int i=0;i<N;++i){ if (A[i]%2==1){ Flag=false; break; } break; } for (int i=2;i<(N+1);i+=2) if (count(A.begin(), A.end(),0)!=1){ break; } else if (count(A.begin(), A.end(),i)!=2){ break; } } ans=((N-1)/2)*((N-1)/2); cout<<ans%MOD<<endl; }
a.cc: In function 'int main()': a.cc:32:3: error: 'else' without a previous 'if' 32 | else{ | ^~~~
s328765158
p03846
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int N;cin>>N; vector<int>A(N); for (int i=0;i<N;++i){ cin>>A[i]; } bool Flag=true; long long ans=0; long long MOD=1000000009; if (N%2==0){ for (int i=0;i<N;++i){ if (A[i]%2==0){ Flag=false; break; } break; } for (int i=1;i<(N+1);i+=2) if (count(A.begin(), A.end(),i)!=2){ break; } } ans=(N/2)*(N/2); cout<<ans%MOD<<endl; else{ for (int i=0;i<N;++i){ if (A[i]%2==1){ Flag=false; break; } break; } for (int 2=0;i<(N+1);i+=2) if (count(A.begin(), A.end(),0)!=1){ break; } else if (count(A.begin(), A.end(),i)!=2){ break; } } ans=((N-1)/2)*((N-1)/2); cout<<ans%MOD<<endl; }
a.cc: In function 'int main()': a.cc:32:3: error: 'else' without a previous 'if' 32 | else{ | ^~~~ a.cc:40:14: error: expected unqualified-id before numeric constant 40 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:40:13: error: expected ';' before numeric constant 40 | for (int 2=0;i<(N+1);i+=2) | ^~ | ; a.cc:40:14: error: lvalue required as left operand of assignment 40 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:40:18: error: 'i' was not declared in this scope 40 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:40:25: error: expected ')' before ';' token 40 | for (int 2=0;i<(N+1);i+=2) | ~ ^ | ) a.cc:40:26: error: 'i' was not declared in this scope 40 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:44:7: error: 'else' without a previous 'if' 44 | else if (count(A.begin(), A.end(),i)!=2){ | ^~~~ a.cc:45:9: error: break statement not within loop or switch 45 | break; | ^~~~~
s652610171
p03846
C++
#include <iostream> #include <vector> using namespace std; int main(){ int N;cin>>N; vector<int>A(N); for (int i=0;i<N;++i){ cin>>A[i]; } bool Flag=true; long long ans=0; long long MOD=1000000009; if (N%2==0){ for (int i=0;i<N;++i){ if (A[i]%2==0){ Flag=false; break; } break; } for (int i=1;i<(N+1);i+=2) if (std::count(A.begin(), A.end(),i)!=2){ break; } } ans=(N/2)*(N/2); cout<<ans%MOD<<endl; else{ for (int i=0;i<N;++i){ if (A[i]%2==1){ Flag=false; break; } break; } for (int 2=0;i<(N+1);i+=2) if (std::count(A.begin(), A.end(),0)!=1){ break; } else if (count(A.begin(), A.end(),i)!=2){ break; } } ans=((N-1)/2)*((N-1)/2); cout<<ans%MOD<<endl; }
a.cc: In function 'int main()': a.cc:24:16: error: 'count' is not a member of 'std'; did you mean 'cout'? 24 | if (std::count(A.begin(), A.end(),i)!=2){ | ^~~~~ | cout a.cc:31:3: error: 'else' without a previous 'if' 31 | else{ | ^~~~ a.cc:39:14: error: expected unqualified-id before numeric constant 39 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:39:13: error: expected ';' before numeric constant 39 | for (int 2=0;i<(N+1);i+=2) | ^~ | ; a.cc:39:14: error: lvalue required as left operand of assignment 39 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:39:18: error: 'i' was not declared in this scope 39 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:39:25: error: expected ')' before ';' token 39 | for (int 2=0;i<(N+1);i+=2) | ~ ^ | ) a.cc:39:26: error: 'i' was not declared in this scope 39 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:43:7: error: 'else' without a previous 'if' 43 | else if (count(A.begin(), A.end(),i)!=2){ | ^~~~ a.cc:43:16: error: 'count' was not declared in this scope 43 | else if (count(A.begin(), A.end(),i)!=2){ | ^~~~~ a.cc:44:9: error: break statement not within loop or switch 44 | break; | ^~~~~
s141024550
p03846
C++
#include <iostream> #include <vector> using namespace std; int main(){ int N;cin>>N; vector<int>A(N); for (int i=0;i<N;++i){ cin>>A[i]; } bool Flag=true; long long ans=0; long long MOD=1000000009; if (N%2==0){ for (int i=0;i<N;++i){ if (A[i]%2==0){ Flag=false; break; } break; } for (int i=1;i<(N+1);i+=2) if (count(A.begin(), A.end(),i)!=2){ break; } } ans=(N/2)*(N/2); cout<<ans%MOD<<endl; else{ for (int i=0;i<N;++i){ if (A[i]%2==1){ Flag=false; break; } break; } for (int 2=0;i<(N+1);i+=2) if (count(A.begin(), A.end(),0)!=1){ break; } else if (count(A.begin(), A.end(),i)!=2){ break; } } ans=((N-1)/2)*((N-1)/2); cout<<ans%MOD<<endl; }
a.cc: In function 'int main()': a.cc:24:11: error: 'count' was not declared in this scope 24 | if (count(A.begin(), A.end(),i)!=2){ | ^~~~~ a.cc:31:3: error: 'else' without a previous 'if' 31 | else{ | ^~~~ a.cc:39:14: error: expected unqualified-id before numeric constant 39 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:39:13: error: expected ';' before numeric constant 39 | for (int 2=0;i<(N+1);i+=2) | ^~ | ; a.cc:39:14: error: lvalue required as left operand of assignment 39 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:39:18: error: 'i' was not declared in this scope 39 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:39:25: error: expected ')' before ';' token 39 | for (int 2=0;i<(N+1);i+=2) | ~ ^ | ) a.cc:39:26: error: 'i' was not declared in this scope 39 | for (int 2=0;i<(N+1);i+=2) | ^ a.cc:43:7: error: 'else' without a previous 'if' 43 | else if (count(A.begin(), A.end(),i)!=2){ | ^~~~ a.cc:43:16: error: 'count' was not declared in this scope 43 | else if (count(A.begin(), A.end(),i)!=2){ | ^~~~~ a.cc:44:9: error: break statement not within loop or switch 44 | break; | ^~~~~
s281864260
p03846
C++
#include <iostream> #include <string> #include <vector> #include <list> #include <map> #include <queue> #include <stack> #include <algorithm> #include <fstream> #include <sstream> #include <iomanip> using namespace std; long long MOD = 1000000007; int main(){ int N; cin >> N; vector<int> cnt(N,0); cnt[0]=1; for(int i=1; 2*i=>N; i++){ cnt[N-2*i]=2; } long long ans=1; for(int i=0; i<N; i++){ int A; cin >> A; cnt[A]++; if(cnt[A]>2){ cout << 0 << endl; return 0; }else if(cnt[A]==1){ ans*=2; ans%=MOD; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:22:22: error: expected primary-expression before '>' token 22 | for(int i=1; 2*i=>N; i++){ | ^
s113057906
p03846
C++
#include <bits/stdc++.h> #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i) #define rep(i,n) FOR(i,0,(n)) #define REPS(i,n) FOR(i,1,(n)+1) #define RREP(i,n) RFOR(i,0,(n)) #define ALL(x) (x).begin(),(x).end() #define RALL(x) (x).rbegin(),(x).rend() #define DEBUG(x) cout << #x << " = " << (x) << endl; #define SORT(x) sort(ALL(x)m); #define RSORT(x) sort(RALL(x)); #define SUM(x) accumulate(ALL(x),0); #define fi first #define se second #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() #define bn(x) ((1<<x)-1) #define dup(x,y) (((x)+(y)-1)/(y)) using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using pii = pair<int, int>; using tiii = tuple<int, int, int>; const ll mod = 1e9+7; const int INF = (1<<30)-1; const ll INFLL = (1LL<<62)-1; const int dx[4] = {1,0,-1,0}; const int dy[4] = {0,1,0,-1}; //cout << fixed << setprecision(10); template<class T> inline int sgn(T n) { if (n > 0) return 1; else if (n < 0) return -1; else return 0; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } 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;} int main () { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vi a(n); rep(i,n) cin >> a[i]; vi b; rep(i,n) { b.push_back(abs(n-1-2*i)); } SORT(a); SORT(b); if (a == b) { ll ans = 1; rep(_,n/2) { ans *= 2; } cout << ans << endl; } else { cout << 0 << endl; } }
a.cc: In function 'int main()': a.cc:10:28: error: expected ')' before 'm' 10 | #define SORT(x) sort(ALL(x)m); | ~ ^ a.cc:57:3: note: in expansion of macro 'SORT' 57 | SORT(a); | ^~~~ a.cc:10:28: error: expected ')' before 'm' 10 | #define SORT(x) sort(ALL(x)m); | ~ ^ a.cc:58:3: note: in expansion of macro 'SORT' 58 | SORT(b); | ^~~~
s172038313
p03846
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define INF -2147483647 int main(){ int a,d=-1,q=1,w=1; int b,c[1000000]={}; cin>>a; for(int i=0;i<a;i++){ cin>>b; c[b]++; } if(a%2==0&&c[0]!=0) w=1; if(a%2==1&&c[0]!=1) w=1; if(w==1){ for(int i=1;i<=a;i++){ if(c[i]==1||c[i]>=3) { q=0; break; } else d++; } } if(q==1) cout<<(((d+1)/2)*((d+1)/2))%100000007; //if(q==1&&a%2==1) cout<<((d+1)/2)*((d+1)/2); else cout<<"0"; cout<<"\n"; }
cc1plus: error: '::main' must return 'int'
s575253612
p03846
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define INF -2147483647 int main(){ int a,d=-1,q=1,w=1; int b,c[1000000]={}; cin>>a; for(int i=0;i<a;i++){ cin>>b; c[b]++; } if(a%2==0&&c[0]!=0) w=1; if(a%2==1&&c[0]!=1) w=1; if(w==1){ for(int i=1;i<=a;i++){ if(c[i]==1||c[i]>=3) { q=0; break; } else d++; } } if(q==1) cout<<(((d+1)/2)*((d+1)/2))%100000007; //if(q==1&&a%2==1) cout<<((d+1)/2)*((d+1)/2); else cout<<"0"; cout<<"\n"; } #include<bits/stdc++.h> using namespace std; #define INF -2147483647 int main(){ int a,d=-1,q=1,w=1; int b,c[1000000]={}; cin>>a; for(int i=0;i<a;i++){ cin>>b; c[b]++; } if(a%2==0&&c[0]!=0) w=1; if(a%2==1&&c[0]!=1) w=1; if(w==1){ for(int i=1;i<=a;i++){ if(c[i]==1||c[i]>=3) { q=0; break; } else d++; } } if(q==1) cout<<(((d+1)/2)*((d+1)/2))%100000007; //if(q==1&&a%2==1) cout<<((d+1)/2)*((d+1)/2); else cout<<"0"; cout<<"\n"; }
cc1plus: error: '::main' must return 'int' cc1plus: error: '::main' must return 'int' a.cc:32:5: error: redefinition of 'int main()' 32 | int main(){ | ^~~~ a.cc:5:5: note: 'int main()' previously defined here 5 | int main(){ | ^~~~
s999487166
p03846
C++
#include<bits/stdc++.h> using namespace std; #define INF -2147483647 int main(){ int a,d=-1,q=1,w=1; int b,c[1000000]={}; cin>>a; for(int i=0;i<a;i++){ cin>>b; c[b]++; } if(a%2==0&&c[0]!=0) w=1; if(a%2==1&&c[0]!=1) w=1; if(w==1){ for(int i=1;i<=a;i++){ if(c[i]==1||c[i]>=3) { q=0; break; } else d++; } } if(q==1&&) cout<<(((d+1)/2)*((d+1)/2))%100000007; //if(q==1&&a%2==1) cout<<((d+1)/2)*((d+1)/2); else cout<<"0"; cout<<"\n"; }
a.cc: In function 'int main()': a.cc:23:12: error: expected primary-expression before ')' token 23 | if(q==1&&) cout<<(((d+1)/2)*((d+1)/2))%100000007; | ^
s308443202
p03846
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(); Arrays.sort(a); if(a[0]==0){ if(n%2==0){ System.out.println(0); return; }else{ for(int i = 1;i < n;i+=2){ if(a[i]!=a[i+1]||a[i]!=i+1){ System.out.println(0); return; } } } }else if(a[0]==1){ if(n%2==1){ System.out.println(0); return; }else{ for(int i = 0;i < n;i+=2){ if(a[i]!=a[i+1]||a[i]!=i+1){ System.out.println(0); return; } } } }else{ System.out.println(0); return; } int x = n/2; long p = (long)Math.pow(2,x); long q = 1000000007 System.out.println(p%q); } public static int lcm(int x, int y){ return x*y/gcd(x,y); } public static int gcd(int x, int y){ if(x < y)return gcd(y,x); if(y==0)return x; return gcd(y,x%y); } }
Main.java:39: error: ';' expected long q = 1000000007 ^ 1 error
s840090809
p03846
C++
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vb = vector<bool>; using vc = vector<char>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvc = vector<vector<char>>; using pii = pair<int, int>; #define fix10 cout << fixed << setprecision(10); #define MOD 1e9+7; #define rep(i,n) for(int i=0; i<(int)(n);i++) int main(){ int n; cin >> n; vector<int> a(n); vector<int> counter(n,0); int tmp; rep(i,n){ cin >> tmp; a.at(i) = tmp; counter.at(tmp)++; } if(n % 2 == 0){ for(int i = 1; i < n ;i += 2){ if(counter.at(i) != 2){ cout << 0 << endl; return 0; } } }else{ if(counter.at(0) != 1){ cout << 0 << endl; return 0; } for(int i=2;i < n;i += 2){ if(counter.at(i) != 2){ cout << 0 << endl; return 0; } } } long answer = 1; rep(i,n/2){ answer *= 2; answer %= MOD; } cout << answer << endl; }
a.cc: In function 'int main()': a.cc:47:12: error: invalid operands of types 'long int' and 'double' to binary 'operator%' 47 | answer %= MOD; | ^ a.cc:47:12: note: in evaluation of 'operator%=(long int, double)'
s558787742
p03846
C++
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vb = vector<bool>; using vc = vector<char>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvc = vector<vector<char>>; using pii = pair<int, int>; #define fix10 cout << fixed << setprecision(10); #define MOD 1e9+7; #define rep(i,n) for(int i=0; i<(int)(n);i++) int main(){ int n; cin >> n; vector<int> a(n); vector<int> counter(n,0); int tmp; rep(i,n){ cin >> tmp; a.at(i) = tmp; counter.at(tmp)++; } if(n % 2 == 0){ for(int i = 1; i < n ;i += 2){ if(counter.at(i) != 2){ cout << 0 << endl; return 0; } } }else{ if(counter.at(0) != 1){ cout << 0 << endl; return 0; } for(int i=2;i < n;i += 2){ if(counter.at(i) != 2){ cout << 0 << endl; return 0; } } } long answer = 1 rep(i,n/2){ answer *= 2; answer %= MOD; } cout << answer << endl; }
a.cc: In function 'int main()': a.cc:12:18: error: expected ',' or ';' before 'for' 12 | #define rep(i,n) for(int i=0; i<(int)(n);i++) | ^~~ a.cc:45:3: note: in expansion of macro 'rep' 45 | rep(i,n/2){ | ^~~ a.cc:45:7: error: 'i' was not declared in this scope 45 | rep(i,n/2){ | ^ a.cc:12:31: note: in definition of macro 'rep' 12 | #define rep(i,n) for(int i=0; i<(int)(n);i++) | ^
s632401975
p03846
C++
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vb = vector<bool>; using vc = vector<char>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvc = vector<vector<char>>; using pii = pair<int, int>; #define fix10 cout << fixed << setprecision(10); #define rep(i,n) for(int i=0; i<(int)(n);i++) #define MOD 1e9+7; int main(){ int n; cin >> n; vector<int> a(n); vector<int> counter(n,0); int tmp; rep(i,n){ cin >> tmp; a.at(i) = tmp; counter.at(tmp)++; } if(n % 2 == 0){ for(int i = 1; i < n ;i += 2){ if(counter.at(i) != 2){ cout << 0 << endl; return 0; } } }else{ if(counter.at(0) != 1){ cout << 0 << endl; return 0; } for(int i=2;i < n;i += 2){ if(counter.at(i) != 2){ cout << 0 << endl; return 0; } } } long answer = 1 rep(i,n/2){ answer *= 2; answer %= MOD; } cout << answer << endl; }
a.cc: In function 'int main()': a.cc:11:18: error: expected ',' or ';' before 'for' 11 | #define rep(i,n) for(int i=0; i<(int)(n);i++) | ^~~ a.cc:45:3: note: in expansion of macro 'rep' 45 | rep(i,n/2){ | ^~~ a.cc:45:7: error: 'i' was not declared in this scope 45 | rep(i,n/2){ | ^ a.cc:11:31: note: in definition of macro 'rep' 11 | #define rep(i,n) for(int i=0; i<(int)(n);i++) | ^
s594173027
p03846
C++
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vb = vector<bool>; using vc = vector<char>; using vs = vector<string>; using vvi = vector<vector<int>>; using vvc = vector<vector<char>>; using pii = pair<int, int>; #define fix10 cout << fixed << setprecision(10); #define rep(i,n) for(int i=0; i<(int)(n);i++); #define MOD 1e9+7; int main(){ int n; cin >> n; vector<int> a(n); vector<int> counter(n,0); int tmp; rep(i,n){ cin >> tmp; a.at(i) = tmp; counter.at(tmp)++; } if(n % 2 == 0){ for(int i = 1; i < n ;i += 2){ if(counter.at(i) != 2){ cout << 0 << endl; return 0; } } }else{ if(counter.at(0) != 1){ cout << 0 << endl; return 0; } for(int i=2;i < n;i += 2){ if(counter.at(i) != 2){ cout << 0 << endl; return 0; } } } long answer = 1 rep(i,n/2){ answer *= 2; answer %= MOD; } cout << answer << endl; }
a.cc: In function 'int main()': a.cc:22:10: error: 'i' was not declared in this scope 22 | a.at(i) = tmp; | ^ a.cc:11:18: error: expected ',' or ';' before 'for' 11 | #define rep(i,n) for(int i=0; i<(int)(n);i++); | ^~~ a.cc:45:3: note: in expansion of macro 'rep' 45 | rep(i,n/2){ | ^~~ a.cc:45:7: error: 'i' was not declared in this scope 45 | rep(i,n/2){ | ^ a.cc:11:31: note: in definition of macro 'rep' 11 | #define rep(i,n) for(int i=0; i<(int)(n);i++); | ^ a.cc:47:12: error: invalid operands of types 'long int' and 'double' to binary 'operator%' 47 | answer %= MOD; | ^ a.cc:47:12: note: in evaluation of 'operator%=(long int, double)'
s611275577
p03846
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define MOD 1000000007 typedef long long int ll; const ll INF=(ll)1e18; ll mod_pow(ll x,ll n, ll mod){ if(n==0) return 1; ll res = mod_pow(x*x%mod, n/2, mod); if(n&1) res = res*x%mod; return res; } int main(){ int N; cin >> N; map<int, int> m; REP(i,N){ int a; cin >> a; m[a]++; } bool flag = if(N%2&1){ for(int i = 0; i < N; i+=2){ if(i==0){ if(m[i]!=1){ cout << 0 << endl; return 0; } }else{ if(m[i]!=2){ cout << 0 << endl; return 0; } } } }else{ for(int i = 1; i < N; i+=2){ if(m[i]!=2){ cout << 0 << endl; return 0; } } } cout << mod_pow(2, N/2, MOD) << endl; }
a.cc: In function 'int main()': a.cc:34:3: error: expected primary-expression before 'if' 34 | if(N%2&1){ | ^~
s208962034
p03846
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; int A[N]; rep(i,N)cin >> A[i]; int a[N]; rep(i,N)a[i] = A[i]; int M=0; sort(a,a+N); if(N%2==1){ for(int i=1;i<N;i+=2){ if((a[i+1]-a[i])!=0)M++;} } else{ for(int i=0;i<N;i+=2){ if((a[i+1]-a[i])!=0)M++;} } if(M==0)cout << pow(2,N/2)%(1000000000+7) << endl; else cout << 0 << endl; return 0; }
a.cc: In function 'int main()': a.cc:25:30: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 25 | if(M==0)cout << pow(2,N/2)%(1000000000+7) << endl; | ~~~~~~~~~~^~~~~~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s547424504
p03846
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin >> n; int arr[n]; unordered_map<int, int> m, vis; for(int i=0; i<n; i++){ cin >> arr[i]; m[arr[i]] += 1; } ll ans = 1; for(auto j:m){ if(vis[j.first]) continue; if(j.second > 2) ans *= 0; if(j.first == 0 && j.second > 1) ans*=0; if(j.first != 0){ans *= 2; ans %= 1000000007} vis[j.first] = 1; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:17:53: error: expected ';' before '}' token 17 | if(j.first != 0){ans *= 2; ans %= 1000000007} | ^ | ;
s121940626
p03846
C++
#include<iostream> #include<map> using namespace std; int main() { int n; cin >> n; map<int, int>a; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; a[tmp]++; } for (auto x : a) { if (x.first == 0) { if (n % 2 == 0) { if (x.second > 0) { cout << 0 << endl; return 0; } } else { if (x.second != 1) { cout << 0 << endl; return 0; } } } else { if (x.second != 2) { cout << 0 << endl; return 0; } } } cout << pow(2,n/2) << endl; return 0; }
a.cc: In function 'int main()': a.cc:35:17: error: 'pow' was not declared in this scope 35 | cout << pow(2,n/2) << endl; | ^~~
s957960215
p03846
C++
#include <iostream> #include <string> #include <list> using namespace std; int OutNumList(list<int>::iterator itr,const int &i) { if (i < 0) { for (int k = 0; k > i; k--) { itr--; } } else { for (int k = 0; i > k; k++) { itr++; } } return *itr; } int main() { // 変数定義 list<int> lisN; int result = 1; int A; int buf = 0; const int WARU = 1000000007; bool boo = false; // 人数の指定 scanf_s("%1d", &A); for (int i = 0; i < A; i++) { scanf_s("%1d", &buf); lisN.push_back(buf); if (lisN.size() >= 2) { lisN.sort(); for (auto itr = lisN.begin(); itr != lisN.end();) { if (*itr == 0) { if (boo) { printf("0"); return 0; }; if (A % 2) { boo = true; itr = lisN.erase(itr); lisN.resize(lisN.size()); } else { printf("0"); return 0; }; itr++; } else { if (OutNumList(itr,0) == OutNumList(itr,0)) { result = result * 2; itr = lisN.erase(itr); itr = lisN.erase(itr); lisN.resize(lisN.size()); } else itr++; } } if (result >= WARU) { result = result % WARU; printf("%d", result); return 0; } } } printf("%d", result); return 0; }
a.cc: In function 'int main()': a.cc:37:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 37 | scanf_s("%1d", &A); | ^~~~~~~ | scanf
s350022019
p03846
C++
#include <iostream> #include <string> #include <list> using namespace std; int OutNumList(list<int>::iterator itr,const int &i) { if (i < 0) { for (int k = 0; k > i; k--) { itr--; } } else { for (int k = 0; i > k; k++) { itr++; } } return *itr; } int main() { // 変数定義 list<int> lisN; int result = 1; int A; int buf = 0; const int WARU = 1000000007; bool boo = false; // 人数の指定 scanf_s("%1d", &A); for (int i = 0; i < A; i++) { scanf_s("%1d", &buf); lisN.push_back(buf); if (lisN.size() >= 2) { lisN.sort(); //for (int x : lisN) { cout <<" "<< x; } for (auto itr = lisN.begin(); itr != lisN.end();) { if (*itr == 0) { if (boo) { printf("0"); return 0; }; if (A % 2) { boo = true; itr = lisN.erase(itr); lisN.resize(lisN.size()); } else { printf("0"); return 0; }; itr++; }// (*itr == 0) else { if (OutNumList(itr,0) == OutNumList(itr,0)) { result = result * 2; itr = lisN.erase(itr); //cout << "itr=" << *itr << endl; itr = lisN.erase(itr); lisN.resize(lisN.size()); //for (int x : lisN) { cout << " " << x << endl; } } else itr++; } }//for(auto itr = lisN.begin(); itr != lisN.end();) if (result >= WARU) { result = result % WARU; printf("%d", result); return 0; } }//(lisN.size() >= A) } printf("%d", result); return 0; }
a.cc: In function 'int main()': a.cc:35:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 35 | scanf_s("%1d", &A); | ^~~~~~~ | scanf
s010988646
p03846
C++
#include <iostream> #include<vector> #include<algorithm> #include<string> #include<map> #include<set> #include<stack> #include<queue> #include<math.h> using namespace std; typedef long long ll; #define int long long typedef vector<int> VI; typedef pair<int, int> pii; typedef priority_queue<int> PQ; #define fore(i,a) for(auto &i:a) #define REP(i,n) for(int i=0;i<n;i++) #define eREP(i,n) for(int i=0;i<=n;i++) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define eFOR(i,a,b) for(int i=(a);i<=(b);++i) #define SORT(c) sort((c).begin(),(c).end()) #define rSORT(c) sort((c).rbegin(),(c).rend()) #define LB(x,a) lower_bound((x).begin(),(x).end(),(a)) #define UB(x,a) upper_bound((x).begin(),(x).end(),(a)) #define INF 1000000000 #define LLINF 9223372036854775807 #define mod 1000000007 //vector<vector<int> > dp; //vector<vector<vector<int> > > vvvi; //dp=vector<vector<int> >(N, vector<int>(M,0)); //vector<pair<int,int> > v; //v.push_back(make_pair(x,y)); //priority_queue<int,vector<int>, greater<int> > q2; signed main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; map<int, int>mp; bool F = true; REP(i, N) { int a; cin >> a; if (a != 0 && N % 2 == 1 && a % 2 == 0) { F = false; } else if (a != 0N % 2 == 0 && a % 2 == 1) { F = false; } mp[a]++; if (a == 0 && mp[a] >= 2) { F = false; } if (mp[a] >= 3) { F = false; } } if (F) { cout << (N/2)*(N/2) % mod << endl; } else { cout << 0 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:51:31: error: unable to find numeric literal operator 'operator""N' 51 | else if (a != 0N % 2 == 0 && a % 2 == 1) { | ^~
s236275599
p03846
C++
include <iostream> #include <string> #include <vector> #include <numeric> #include <algorithm> using namespace std; long int chackFun(int A) { A = A - 1; long int buf = A; while ((A - 2) >= 0) { A = A - 2; buf = buf + A; } return buf * 2; } int main() { // 変数定義 vector<int> vN; int result = 1; int A; // 人数の指定 scanf("%d", &A); for (int i = 0; i < A; i++) { int* buf = new int; scanf("%d", buf); vN.emplace_back(*buf); delete buf; } sort(vN.begin(), vN.end()); if (chackFun(A) != accumulate(vN.begin(), vN.end(), 0)) { result = 0; } else { for (vector<int>::iterator itr = vN.begin(); itr != vN.end(); itr++) { if (*itr == 0) {} else { if (*itr == *(itr++)) { result = result * 2; }; }; } } printf("%d", result); return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/char_traits.h:50: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared 144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type 146 | static _GLIBCXX14_CONSTEXPR std::size_t | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared 150 | find(const char_type* __s, std::size_t __n, const char_type& __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared 153 | move(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared 156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n); | ^~~ /usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared 159 | assign(char_type* __s, std::size_t __n, char_type __a); | ^~~ /usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared 187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n) | ^~~ /usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)': /usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'? 189 | for (std::size_t __i = 0; __i < __n; ++__i) | ^~~ | __n /usr/include/c++/14/bits/char_traits.h: At global scope: /usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type 198 | _GLIBCXX14_CONSTEXPR std::size_t |
s724609309
p03846
C++
/* 友利奈緒ぱわーでACしてくれ!!!!!!!!!!!! Charlotteまだ見てない人は見ような!!!!!!! /  /:/              \:ヽ \         /  /                     \  ヽ      \__L 彡                    ヽ  ',        フ /   /  /  /   ,         ヽ  ',  j        レ    /  /  /                ',  ヽ j         //     ! /_l_/__ノ   { \}       ',  ',/       i ハ     { 从j ハ i    ',  ト-、}  i i  }  jj       ( ハ   (  川 ハ ハ  !  ' ハ  ハ j j ,'   八     <_,ィ∧   斗芹テミxハ ハ  レ } /__レレ /   ∧ \ ノ         ∨ \  ゝ 辷:ソ    ) 芹レ心ヾレ′ / ト-- ´    \ー‐' ノ   \ゝ           ゞ:_ソ "/  /  ヽ        フ    i八 " "   ,       ム彡    \       /  /  j  ト           " "イト<      \\      /  /   j //ヽ、   ∩     イ { {   ̄ フフへ \\     ( /    ,/ /   i >――<ニニニニ┐  〃/: : ヽ ヽヽ     /  ィT´/ /┌―  ̄ ̄ /::: , ,)      〃//: : : : : :} ヽヽ)    / /  ∧ヾi┌― { { ̄    ノ:::ト゚<      ∥//: : : : : : : : i  ノ ノ .   ( 人  {:ヽヾi∨ ∧V    /:::/ 、ヽ    ∥/: : : : : : : : : :} /    V ( ∧: :\'∨ ∧V   ノ:::/  ∧ 〉___∥: : : : : :/: : : :レ        /∧: : : : ∨ ∧V┬イ:::ノ  〈 TT | |{{: : : : /: : : : : ∧   ノ       ( ハ: : : : :∨'T∧Vi i (    V ! ! {{: : / : : : : : : / ー ノ      V ハ: : : : :∨ヘ∧V i ゝゝ  i/⌒\{/ : : : : : : : /ー― ´       ∨ ヽ: : : : :∨ヘ∧∨i 〉 〉 / /二  ): : : : : : : : :/ (https://seesaawiki.jp/asciiart/d/Charlotte より) */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; #define int ll // #define DEBUG 42 inline void nprint(){} template <class Head, class... Tail> inline void nprint(Head &&head, Tail &&... tail) { cout << head << endl; nprint(move(tail)...); } #ifdef DEBUG #define eprint(...) nprint(__VA_ARGS__) #else #define eprint(...) if(0==1) cout << 1 << endl; #endif #define Yes(a) cout << (a ? "Yes" : "No") << endl #define YES(a) cout << (a ? "YES" : "NO") << endl #define POSSIBLE(a) cout << (a ? "POSSIBLE" : "IMPOSSIBLE") << endl using vb = vector<bool>; using vvb = vector<vb>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; template<class T> using V = vector<T>; template<class T> using VV = vector<V<T>>; #define fi first #define se second #define maxs(x,y) (x=max(x,y)) #define mins(x,y) (x=min(x,y)) using pii = pair<int,int>; using pll = pair<ll,ll>; #define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i) #define REP(i,n) FOR(i,0,n) #define REPS(i,n) REP(i,n+1) #define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i) #define RREP(i,n) RFOR(i,0,n) #define RREPS(i,n) RREP(i,n+1) #define ALL(obj) (obj).begin(), (obj).end() #define RALL(obj) (obj).rbegin(), (obj).rend() #define PERM(c) sort(ALL(c)); for(bool cp = true;cp;cp = next_permutation(ALL(c))) #define eb(val) emplace_back(val) const double PI = acos(-1), EPS = 1e-10; const ll MOD = 1E9+7; int dx[] = {1,0,-1,0}; int dy[] = {0,1,0,-1}; template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p){ return s << "(" << p.first << ", " << p.second << ")"; } template<class T> istream& operator>>(istream &is,vector<T> &st){ for(size_t i=0;i<st.size();++i) is >> st[i]; return is; } template<class T> istream& operator>>(istream &is,vector<vector<T>> &st){ for(size_t i=0;i<st.size();++i) is >> st[i]; return is; } template<class T> ostream& operator<<(ostream &os, const vector<T> &st){ for(size_t i=0;i<st.size();++i){ if(i==st.size()-1) os << st[i]; else os << st[i] << " "; } return os; } template<class T> ostream& operator<<(ostream &os, const vector<vector<T>> &st){ for(size_t i=0;i<st.size();++i){ os << st[i]; if(i!=st.size()-1) os << endl; } return os; } template<typename T> inline T power(T a,T n,T modu = 1e9+7){ T res = 1,r = a; for (; n > 0;n>>=1,r*=r) res *= (n & 1? r:1),res%=modu,r%=modu; return res; } signed main(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10); int n; cin >> n; vi a(n); cin >> a; sort(ALL(a)); vi b(n); if(n&1){ b[0] = 0; REP(i,n/2){ b[2*i+1] = b[2*i]+2; b[2*i+2] = b[2*i]+2; } }else{ b[0] = b[1] = 1; REP(i,n/2-1){ b[2*i+3] = b[2*i+2] = b[2*i]+2; } } if(a!=b) cout << 0 << endl; else cout << power(2,n/2) << endl; }
a.cc: In function 'int main()': a.cc:127:21: error: no matching function for call to 'power(int, ll)' 127 | else cout << power(2,n/2) << endl; | ~~~~~^~~~~~~ a.cc:99:10: note: candidate: 'template<class T> T power(T, T, T)' 99 | inline T power(T a,T n,T modu = 1e9+7){ | ^~~~~ a.cc:99:10: note: template argument deduction/substitution failed: a.cc:127:21: note: deduced conflicting types for parameter 'T' ('int' and 'long long int') 127 | else cout << power(2,n/2) << endl; | ~~~~~^~~~~~~
s917225546
p03846
C++
#include <iostream> #include <iomanip> #include <stdio.h> #include <math.h> #include <string> //#include <search.h> #include <algorithm> //#include <vector> using namespace std; int main() { int n,arr[100000],arr2[100000]={0},s=0,check=0; cin>>n; for(int i=0;i<n;i++){ cin>>arr[i]; if(arr2[arr[i]]==0 && arr[i]!=0){ s++; } arr2[arr[i]]++; } // if(arr2[n-1]<2) cout<<0; else{ cout<<s*s; } return 0; }
a.cc: In function 'int main()': a.cc:22:2: error: 'else' without a previous 'if' 22 | else{ | ^~~~
s030554311
p03846
Java
import java.util.Arrays; import java.util.Scanner; class Main{ static long mod=1000000007; // 10e9 + 7 static long pow(long a, long x){ if(x == 1) return a % mod; else if(x % 2 == 0) return pow((a * a) % mod, x / 2) % mod; else return (a * pow((a * a) % mod, x / 2)) % mod; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; int[] B = new int[N]; for(int i = 0; i < N; i++) A[i] = sc.nextInt(); if(N % 2 == 0) { for(int i = 0; i + 1 < N; i += 2) { B[i] = i + 1; B[i + 1] = i + 1; } }else { B[0] = 0; for(int i = 1; i + 1 < N; i += 2) { B[i] = i + 1; B[i + 1] = i + 1; } } Arrays.sort(A); boolean check = true; long ans = pow(2, (long)(N / 2), mod); for(int i = 0; i < N; i++) if(B[i] != A[i]) check = false; System.out.println(check ? ans : 0); } }
Main.java:29: error: method pow in class Main cannot be applied to given types; long ans = pow(2, (long)(N / 2), mod); ^ required: long,long found: int,long,long reason: actual and formal argument lists differ in length 1 error
s480053107
p03846
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i=0;i<(int)(n);i++) #define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--) #define irep(i,n,m) for(int i=(int)(n);i<(int)(m);i++) #define all(x) (x).begin(),(x).end() typedef long long ll; using namespace std; int main(){ int n; cin>>n; vector<int> a(n); rep(i,n) cin>>a.at(i); sort(all(a)); if(n%2==0){ for(int i=0;i<n;i+=2){ if(a.at(i)!=i+1||a.at(i+1)!=i+1){ cout<<0<<endl; return 0; } } cout<<pow(2,n/2)<<endl; } else{ if(a.at(0)!=0){ cout<<0<<endl; return 0; } for(int i=1;i<n;i+=2){ if(a.at(i)!=i+1||a.at(i+1)!=i+1){ cout<<0<<endl; return 0; } } cout<<pow(2,(int)n/2)%1000000007<<endl; } }
a.cc: In function 'int main()': a.cc:35:30: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 35 | cout<<pow(2,(int)n/2)%1000000007<<endl; | ~~~~~~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s077872470
p03846
C++
#include <bits/stdc++.h> using namespace std; int n,a[100004]; bool ok=true; int main(){ cin>>n; for(int i=0;i<n;i++)cin>>a[i]; sort(a,a+n); if(n%2==0){ for(int i=0;i<n-1;i+=2){ if(a[i]!=i+1||a[i+1]!=i+1){ok=false;break;} } }else{ if(a[0]!=0)ok=false; for(int i=1;i<n-1;i+=2){ if(a[i]!=i+1||a[i]!=i+1){ok=false;break;} } } if(ok){ int ppap=n/2; long long ppap2=pow(a,ppap); cout<<ppap2<<endl; }else{ cout<<0<<endl; } }
a.cc: In function 'int main()': a.cc:23:28: error: no matching function for call to 'pow(int [100004], int&)' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Constant, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::valarray<_Tp>' and 'int' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_Constant, _Tp, _Tp>, _Tp> std::pow(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::valarray<_Tp>' and 'int [100004]' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const valarray<_Tp>&, const valarray<_Tp>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::valarray<_Tp>' and 'int [100004]' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int [100004]' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const valarray<typename _Dom::valarray>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int [100004]' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename _Dom1::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:549:1: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int [100004]' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:2482:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const complex<_Tp>&, const complex<_Up>&)' 2482 | pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y) | ^~~ /usr/include/c++/14/complex:2482:5: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::complex<_Tp>' and 'int [100004]' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/complex:2474:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const _Tp&, const complex<_Up>&)' 2474 | pow(const _Tp& __x, const std::complex<_Up>& __y) | ^~~ /usr/include/c++/14/complex:2474:5: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::complex<_Up>' and 'int' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/complex:2466:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const complex<_Tp>&, const _Up&)' 2466 | pow(const std::complex<_Tp>& __x, const _Up& __y) | ^~~ /usr/include/c++/14/complex:2466:5: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::complex<_Tp>' and 'int [100004]' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/complex:1339:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const _Tp&, const complex<_Tp>&)' 1339 | pow(const _Tp& __x, const complex<_Tp>& __y) | ^~~ /usr/include/c++/14/complex:1339:5: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::complex<_Tp>' and 'int' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/complex:1328:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, const complex<_Tp>&)' 1328 | pow(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~ /usr/include/c++/14/complex:1328:5: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::complex<_Tp>' and 'int [100004]' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/complex:1294:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, const _Tp&)' 1294 | pow(const complex<_Tp>& __x, const _Tp& __y) | ^~~ /usr/include/c++/14/complex:1294:5: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::complex<_Tp>' and 'int [100004]' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ /usr/include/c++/14/complex:1285:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, int)' 1285 | pow(const complex<_Tp>& __z, int __n) | ^~~ /usr/include/c++/14/complex:1285:5: note: template argument deduction/substitution failed: a.cc:23:28: note: mismatched types 'const std::complex<_Tp>' and 'int [100004]' 23 | long long ppap2=pow(a,ppap); | ~~~^~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:114: /usr/include/c++/14/cmath:1074:5: note: candidate: 'template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)' 1074 | pow(_Tp __x, _Up __y) | ^
s567707143
p03846
Java
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); ret = (long) Math.pow(2, (long) N / 2); ret = (long) ret % 1000000007; System.out.println(ret); } }
Main.java:9: error: cannot find symbol ret = (long) Math.pow(2, (long) N / 2); ^ symbol: variable ret location: class Main Main.java:10: error: cannot find symbol ret = (long) ret % 1000000007; ^ symbol: variable ret location: class Main Main.java:10: error: cannot find symbol ret = (long) ret % 1000000007; ^ symbol: variable ret location: class Main Main.java:11: error: cannot find symbol System.out.println(ret); ^ symbol: variable ret location: class Main 4 errors
s957541049
p03846
C++
#include <math.h> #include <stdio.h> #include <algorithm> #include <cstdlib> #include <iostream> #include <list> #include <numeric> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long int main() { int N; cin >> N; vector<int> A(N); int a; for (int i = 0; i < N; i++) { cin >> a; A.push_back(a); // Nが偶数の時、奇数の時で考える **数値判定** if (N % 2 == 0) { /* または 偶数だったら終了/奇数だったら終了 */ if (a % 2 == 0) { cout << 0 << endl; return 0; } } else { if (a % 2 != 0) { cout << 0 << endl; return 0; } } // N偶数 入力値全て奇数 // N奇数 入力値全て偶数 } int count[N]; for (int i = 0; i < N; i++) count[i] = 0; // Nが偶数の時/奇数の時 **数値の数の判定** if (N % 2 == 0) { for (int i = 0; i < N; i++) { count[A.at(i)]++; //同じ数が3つ以上あったら終了 if (count[A.at(i)] > 2) { cout << 0 << endl; return 0; } } } else { for (int i = 0; i < N; i++) { count[A.at(i)]++; /* 0以外の同じ数が3つ以上あったら終了 0が二つ以上あったら終了 */ if (count[A.at(i)] > 2 || count[0] > 1) { cout << 0 << endl; return 0; } } } cout << pow(2, N / 2) % 100000007 << endl; return 0; }
a.cc: In function 'int main()': a.cc:73:25: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 73 | cout << pow(2, N / 2) % 100000007 << endl; | ~~~~~~~~~~~~~ ^ ~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s325819564
p03846
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n),cnt(n,0); for(int i=0;i<n;i++){ cin >> a[i]; } for(int i=0;i<n;i++){ cnt[a[i]]++; } bool ok=true; if(n%2==1){ if(cnt[0]!=1)ok=false; for(int i=1;i<n;i++){ if(i%2==1){ if(cnt[i]!=0)ok=false; } else if(i%2==0){ if(cnt[i]!=2)ok=false; } } if(ok){ long long ans=pow(2,(n-1)/2)%1000000007; cout << ans << endl; } else{ cout << '0' << endl; } } else if(n%2==0){ for(int i=0;i<n;i++){ if(i%2==0){ if(cnt[i]!=0)ok=false; } if(i%2==1){ if(cnt[i]!=2)ok=false; } } if(ok){ long long stl=pow(2,n/2)%1000000007; cout << stl << endl; } else{ cout << '0' << endl; } } }
a.cc: In function 'int main()': a.cc:26:33: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 26 | long long ans=pow(2,(n-1)/2)%1000000007; | ~~~~~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double} a.cc:44:31: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 44 | long long stl=pow(2,n/2)%1000000007; | ~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s817774763
p03846
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1e9 + 7; signed main(){ int N; cin >> N; vector<int> a(N), is_same(N); for(int i=0;i<N;i++) cin >> a[i]; for(int l=0;l<=N-1;l++) { int r = (N - 1) - l; is_same[i] = abs(l-r); } sort(a.begin(), a.end()); sort(is_same.begin(), is_same.end()); bool flag = true; for(int i=0;i<N;i++) { if(a[i]!=is_same[i]) { flag = false; break; } } if(!flag) { cout << 0 << endl; return 0; } //初期化 int key = is_smae[0]; ll cnt = 1, ans = 1; for(int i=1;i<N;i++) { if(key == is_same[i]) { cnt++; }else{ ans *= cnt; ans %= MOD; cnt = 1; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:18:41: error: 'i' was not declared in this scope 18 | is_same[i] = abs(l-r); | ^ a.cc:41:27: error: 'is_smae' was not declared in this scope; did you mean 'is_same'? 41 | int key = is_smae[0]; | ^~~~~~~ | is_same
s245764162
p03846
C++
#include<stdio.h> #include<math.h> #include<stdlib.h> int main() { long long int n,i,j,temp,b[100099]= {0},k,a[100099],count=0,p,x; scanf("%lld",&n); for(i=0; i<n; i++) { scanf("%lld",&a[i]); } for(i=n-1,k=0; i>=0; i--,k++) { b[k]=abs(i-k); } sort(a, a+n); sort(b, b+n-1); for(i=0; i<n; i++) { if(a[i]!=b[i]) { count=1; break; } } if(count==1) { printf("0\n"); } else { p=n/2; x=(pow(2,p))%1000000007; printf("%lld\n",x); } return 0; }
a.cc: In function 'int main()': a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 16 | sort(a, a+n); | ^~~~ | sqrt a.cc:33:21: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 33 | x=(pow(2,p))%1000000007; | ~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s284155540
p03846
C++
#include<bits/stdc++.h> using namespace std; #define ll long long #define vd(T) vector<vector<T>> #define v(T) vector<T> #define mod (ll)(1e9+7) #define pp(T) pair<T,T> #define pb push_back #define mp make_pair #define NN 100005 #define IO ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0) #define loop(i,a,b) for(ll i=a;i<b;i++) #define DEBUG cout<<"***********DEBUGGING***********"<<endl #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; ll power(ll a,ll b){ if(b==0) return 1; ll s=power(a,b/2); s*=s;if(b&1) return s*a; return s;} ll powermod(ll a,ll b,ll m){ if(b==0) return 1; ll s=power(a,b/2);s*=s; s%=m; if(b&1) return (s*a)%m; return s;} inline int add(ll a,ll b,ll m=0){ if(m==0) return a+b; return (a%m+b%m)%m; } inline int sub(ll a,ll b ,ll m=0){ if(m==0) return a-b; return ((a%m-b%m)%m+m)%m; } inline int mul(ll a,ll b,ll m=0){ if(m==0)return (a*b); return ((a%m)*(b%m))%m; } inline int div(ll a,ll b,ll m=0){ if(m==0) return a/b; return ((a%m)*(powermod(a,b,m-2)%m))%m; } bool isopen(char c){ return ((c=='(')||(c=='{')||(c=='[')); } ll longest_balanced_parenthesis(string a,ll n){ stack<char> s; ll start=0; ll ans=0,m=0; for(ll i=0;i<n;i++){ if(isopen(a[i])){ s.push(a[i]); } else{ if(isopen(a[i])|| s.empty()){ m=max(m,ans); continue; } else{ s.pop(); ans+=2; m=max(ans,m); } } } return m; } ll setup_k(ll *a,ll k){ ordered_set x; // Now , insert and then check number of integers less than k by just using x.order_of_key(k+1) } int main() { IO; ll n; cin>>n; vector<ll> a(n+1); a[0]=0; map<ll,ll> m; for(ll i=0;i<n;i++){ cin>>a[i+1]; m[a[i+1]]++; } if(n==1){ if(a[i]!=0){ cout<<0<<endl; } else cout<<1<<endl; return 0; } for(ll i=1;i<=n;i++){ if(a[i]==0){ if(m[a[i]]>1 || (n%2==0)){ cout<<0<<endl; return 0; } } } if(n%2){ for(auto i:m){ if(i.second==1 && (i.first!=0)){ cout<<0<<endl; return 0; } } } ll cnt=0; cnt=m.size()-(m.count(0)); cout<<powermod(2,cnt,mod)<<endl; }
a.cc: In function 'long long int setup_k(long long int*, long long int)': a.cc:72:1: warning: no return statement in function returning non-void [-Wreturn-type] 72 | } | ^ a.cc: In function 'int main()': a.cc:90:14: error: 'i' was not declared in this scope 90 | if(a[i]!=0){ | ^