submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s271418864
p03846
C++
#include <iostream> #include <vector> #include <map> using namespace std; const int NUM = 1000000007; int main() { int n; cin >> n; map<int, int> mp; for (int i = 0; i < n; i++) { int a; cin >> a; mp[a]++; } if (n % 2 == 0) { for (int i = 1; i < n; i += 2) { if (mp[i] != 2) { cout << 0 << endl; return 0; } } cout << pow(2, n / 2) << endl; return 0; } else { if (mp[0] != 1) { cout << 0 << endl; return 0; } for (int i = 2; i < n; i += 2) { if (mp[i] != 2) { cout << 0 << endl; return 0; } } cout << pow(2, (n - 1) / 2) << endl; return 0; } return 0; }
a.cc: In function 'int main()': a.cc:22:25: error: 'pow' was not declared in this scope 22 | cout << pow(2, n / 2) << endl; | ^~~ a.cc:36:25: error: 'pow' was not declared in this scope 36 | cout << pow(2, (n - 1) / 2) << endl; | ^~~
s689423094
p03846
C++
#include <stdio.h> #include <iostream> #include <algorithm> #include <cmath> #include <numeric> #include <vector> #include <set> #include <map> #include <cstring> #include <unordered_map> #define lld long long int #define DBG1(vari1) cerr<<#vari1<<" = "<<(vari1)<<endl; #define DBG2(vari1,vari2) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<endl; #define DBG3(vari1,vari2,vari3) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<" "<<#vari3<<" = "<<(vari3)<<endl; using namespace std; #define MOD (ll)(1e9 + 7) int coun[100005]; int power(int base, int exp) { int ans = 1; while(exp) { if(exp&1) ans = (ans * base) % MOD; base = (base * base) % MOD; exp /= 2; } return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("input.txt", "r", stdin); int n; cin >> n; int arr[n]; for(int i=0;i<n;i++) { cin >> arr[i]; coun[arr[i]]++; } int flag=1; if(n&1) { for(int i=2;i<n;i+=2) { if(coun[i]!=2||coun[i-1]!=0) { flag=0; break; } } if(coun[0]!=1) flag=0; } else { for(int i=1;i<n;i+=2) { if(coun[i]!=2||coun[i+1]!=0) { flag=0; break; } } if(coun[0]!=0) flag=0; } if(flag) { cout << power(2,n/2); } else cout << "0"; }
a.cc: In function 'int power(int, int)': a.cc:16:14: error: 'll' was not declared in this scope; did you mean 'lld'? 16 | #define MOD (ll)(1e9 + 7) | ^~ a.cc:22:46: note: in expansion of macro 'MOD' 22 | ans = (ans * base) % MOD; | ^~~ a.cc:16:14: error: 'll' was not declared in this scope; did you mean 'lld'? 16 | #define MOD (ll)(1e9 + 7) | ^~ a.cc:23:40: note: in expansion of macro 'MOD' 23 | base = (base * base) % MOD; | ^~~
s010558375
p03846
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int a[n]; long long ans=1; for(int i=0;i<n;i++){ cin>>a[i]; } sort(a,a+n); reverse(a,a+n); if(n%2==0){ for(int i=0;i<n-1;i++){ if(i%2==0){ if(a[i]!=a[i+1]){ cout<<0<<endl; return 0; } } else{ if(a[i]!=a[i+1]+2){ cout<<0<<endl; return 0; } } } while(true){ ans=ans*2; n=n-2; if(n==0){ ans=ans%1000000007; cout<<ans<<endl; return 0; } } } else{ for(int i=0;i<n-1;i++){ if(i%2==0){ if(a[i]!=a[i+1]){ cout<<0<<endl; return 0; } } else{ if(a[i]!=a[i+1]+2){ cout<<0<<endl; return 0; } } } while(true){ ans=ans*2; n=n-2; if(n==1){ ans=ans%1000000007 cout<<ans<<endl; return 0; } } } }
a.cc: In function 'int main()': a.cc:57:31: error: expected ';' before 'cout' 57 | ans=ans%1000000007 | ^ | ; 58 | cout<<ans<<endl; | ~~~~
s773252904
p03846
C++
#include <iostream> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <algorithm> using namespace std; int n[1000000]; int N; long long pow(int n) { long long base = 2, ans = 1; while (n) { if (n & 1) { ans *= base; } base *= base; n = n >> 1; } return base; } int main() { cin >> N; for (int i = 0; i < N; i++) cin >> n[i]; sort(n, n + N); if (N % 2 == 1) { bool f = 1; int p = 2; if (n[0] != 0) f = 0; for (int i = 1; i <= N - 2; i += 2) { if (n[i] != p || n[i + 1] != p) { f = 0; break; } p += 2; } if (f) { cout << pow((N - 1) / 2)%10E9+7 << endl; } else cout << '0' << endl; } else { bool f = 1; int p = 1; for (int i = 0; i <= N - 2; i += 2) { if (n[i] != p || n[i + 1] != p) { f = 0; break; } p += 2; } if (f) { cout << pow(N / 2)%10E9+7 << endl; } else cout << '0' << endl; } return 0; }
a.cc: In function 'int main()': a.cc:51:37: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 51 | cout << pow((N - 1) / 2)%10E9+7 << endl; | ~~~~~~~~~~~~~~~~^~~~~ | | | | long long int double a.cc:71:31: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 71 | cout << pow(N / 2)%10E9+7 << endl; | ~~~~~~~~~~^~~~~ | | | | | double | long long int
s095315811
p03846
C++
#include <bits/stdc++.h> using namespace std; int main() { ll MOD = 1e9 + 7; int n; cin >> n; int a[n]; map<int, int> m; REP(i, n){ cin >> a[i]; m[a[i]]++; } bool flag = 0; if (n % 2){ for (auto x : m){ if (x.first == 0){ if (x.second != 1) flag = 1; } else if (x.second != 2) flag = 1; } } else { for (auto x : m){ if (x.second != 2) flag = 1; } } if (flag) cout << 0 << endl; else { ll ans = 1; for (int i = 0; i < n/2; i++){ ans *= 2; ans %= MOD; } cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:7:9: error: 'll' was not declared in this scope 7 | ll MOD = 1e9 + 7; | ^~ a.cc:12:13: error: 'i' was not declared in this scope 12 | REP(i, n){ | ^ a.cc:12:9: error: 'REP' was not declared in this scope 12 | REP(i, n){ | ^~~ a.cc:35:19: error: expected ';' before 'ans' 35 | ll ans = 1; | ^~~~ | ; a.cc:37:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 37 | ans *= 2; | ^~~ | abs a.cc:38:32: error: 'MOD' was not declared in this scope 38 | ans %= MOD; | ^~~ a.cc:41:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 41 | cout << ans << endl; | ^~~ | abs
s247168052
p03846
C++
#include <iostream> #include <map> using namespace std; bool check(map<int, int> reportsMap, int noses) { int maxReport = noses - 1; if (noses % 2 == 0) { for (int i = 1; i <= maxReport; i+=2) { if (reportsMap[i] != 2) { return false; } } } else { if (reportsMap[0] != 1) { return false; } for (int i = 2; i <= maxReport; i+=2) { if (reportsMap[i] != 2) { return false; } } } return true; } int main() { int noses; cin >> noses; map<int, int> reportsMap; for (int i = 0; i < noses; i++) { int report; cin >> report; if (reportsMap.count(report)) { reportsMap[report] += 1; } else { reportsMap[report] = 1; } }   long long answer = 1;   for (int j = 0; j < (noses / 2); j++) {   answer = answer * 2 % 1000000007;   }    if (check(reportsMap, noses) == false) { answer = 0; } cout << answer << endl; }
a.cc:38:1: error: extended character   is not valid in an identifier 38 |   long long answer = 1; | ^ a.cc:39:1: error: extended character   is not valid in an identifier 39 |   for (int j = 0; j < (noses / 2); j++) { | ^ a.cc:40:1: error: extended character   is not valid in an identifier 40 |   answer = answer * 2 % 1000000007; | ^ a.cc:41:1: error: extended character   is not valid in an identifier 41 |   } | ^ a.cc:43:1: error: extended character   is not valid in an identifier 43 |    if (check(reportsMap, noses) == false) { | ^ a.cc:43:1: error: extended character   is not valid in an identifier a.cc:43:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:38:1: error: '\U00003000' was not declared in this scope 38 |   long long answer = 1; | ^~ a.cc:39:3: error: expected ';' before 'for' 39 |   for (int j = 0; j < (noses / 2); j++) { | ^ ~~~ | ; a.cc:39:21: error: 'j' was not declared in this scope 39 |   for (int j = 0; j < (noses / 2); j++) { | ^ a.cc:43:1: error: '\U00003000\U00003000\U00003000if' was not declared in this scope 43 |    if (check(reportsMap, noses) == false) { | ^~~~~~~~ a.cc:47:12: error: 'answer' was not declared in this scope 47 | cout << answer << endl; | ^~~~~~
s891551890
p03846
C++
#include <algorithm> #include <string> using namespace std; const long mod = 1e9+7; #define REP(i, n) for(int i = 0; i < (int)n; ++i) int main() { int N; int a; cin >> N; vector<int> A; REP(i, N) { cin >> a; A.push_back(a); } int init = 0; if (N % 2 == 0) { init = 1; } sort(A.begin(), A.end()); for (int i = init; i <= N; i += 2) { if (i==0){ if (A[0]==A[1]) { cout << 0 << endl; return 0; } } else if (i != 0) { if (A[i - 1] != A[i]) { cout << 0 << endl; return 0; } } } long out = 1; REP(i, N / 2) out = out * 2 % mod; cout << out << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'cin' was not declared in this scope 13 | cin >> N; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <string> +++ |+#include <iostream> 3 | a.cc:14:5: error: 'vector' was not declared in this scope 14 | vector<int> A; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include <string> +++ |+#include <vector> 3 | a.cc:14:12: error: expected primary-expression before 'int' 14 | vector<int> A; | ^~~ a.cc:17:9: error: 'A' was not declared in this scope 17 | A.push_back(a); | ^ a.cc:23:10: error: 'A' was not declared in this scope 23 | sort(A.begin(), A.end()); | ^ a.cc:27:17: error: 'cout' was not declared in this scope 27 | cout << 0 << endl; | ^~~~ a.cc:27:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:27:30: error: 'endl' was not declared in this scope 27 | cout << 0 << endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <string> +++ |+#include <ostream> 3 | a.cc:32:17: error: 'cout' was not declared in this scope 32 | cout << 0 << endl; | ^~~~ a.cc:32:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:32:30: error: 'endl' was not declared in this scope 32 | cout << 0 << endl; | ^~~~ a.cc:32:30: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' a.cc:39:5: error: 'cout' was not declared in this scope 39 | cout << out << endl; | ^~~~ a.cc:39:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:39:20: error: 'endl' was not declared in this scope 39 | cout << out << endl; | ^~~~ a.cc:39:20: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s504756174
p03846
C++
#include <algorithm> #include <cmath> #include <iostream> using namespace std; int main() { int N, A[100000]; 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 - 3; i += 2) { if (!(A[i] == A[i + 1] && A[i] + 2 == A[i + 2] && A[i + 1] + 2 == A[i + 3])) { cout << 0 << endl; return 0; } } } else { if (A[0] != 0) { cout << 0 << endl; return 0; } for (int i = 1; i < N - 3; i += 2) { if (!(A[i] == A[i + 1] && A[i] + 2 == A[i + 2] && A[i + 1] + 2 == A[i + 3])) { cout << 0 << endl; return 0; } } } cout << (N % 2 == 0 ? ((int)pow(2, N / 2) % 1000000007) : ((int)pow(2, (N - 1) / 2)) % 1000000007) << endl; return 0;
a.cc: In function 'int main()': a.cc:43:12: error: expected '}' at end of input 43 | return 0; | ^ a.cc:7:12: note: to match this '{' 7 | int main() { | ^
s511244331
p03846
C++
#include<bits/stdc++.h> #define mins(a,b) a=min(a,b) #define maxs(a,b) a=max(a,b) using namespace std; int main(){ int n; cin>>n; int ans=1; int t[100010]; int a[100010]; for(int i=0;i<100010;i++){ t[i]=0; a[i]=0; } for(int i=0;i<n;i++){ cin>>t[i]; a[t[i]]++; } for(int i=0;i<n;i++){ if(a[i]==2) ans=(2*ans)%1000000007; if(n%2==0){ if(i==0 and a[i]>1) ans=0; if(a>=1 and i%2==0) ans=0; } if(n%2==1){ if(a[i]<2 or a[i]>2) ans=0; if(a>=1 and i%2==1) ans=0; } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:25:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 25 | if(a>=1 and i%2==0) | ~^~~ a.cc:31:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 31 | if(a>=1 and i%2==1) | ~^~~
s105599756
p03846
C++
#include <bits/stdc++.h> using namespace std; template<int mod> struct ModInt { using ll = long long; int x; template<class T> ModInt(T a) { x = a % mod; if (x < 0) { x += mod; } } ModInt() : x(0) {} inline ModInt& operator+=(const ModInt& rhs) { (*this) += rhs.x; return *this; } template<class T> inline ModInt& operator+=(const T rhs) { x += rhs % mod; if (x < 0) x += mod; x %= mod; return *this; } inline ModInt& operator-=(const ModInt& rhs) { (*this) -= rhs.x; return *this; } template<class T> inline ModInt& operator-=(const T rhs) { x -= rhs % mod; if (x < 0) x += mod; x %= mod; return *this; } inline ModInt& operator*=(const ModInt& rhs) { (*this) *= rhs.x; return *this; } template<class T> inline ModInt& operator*=(const T rhs) { ll res = (ll) x * (rhs % mod); x = res % mod; if (x < 0) x += mod; return *this; } inline ModInt& operator/=(const ModInt& rhs) { (*this) /= rhs.x; return *this; } template<class T> inline ModInt& operator/=(const T rhs) { int t = rhs % mod; if (t < 0) t += mod; ll res = modpow(t); (*this) *= res; return *this; } inline ModInt& operator=(const ModInt& rhs) { (*this) = rhs.x; return *this; } template<class T> inline ModInt& operator=(const T rhs) { x = rhs % mod; if (x < 0) x += mod; return *this; } inline int operator==(const ModInt& rhs) const { return (*this) == rhs.x; } template<class T> inline int operator==(const T rhs) const { ModInt t(rhs); return (*this).x == t.x; } inline int operator!=(const ModInt& rhs) const { return (*this) != rhs.x; } inline int operator!=(const int rhs) const { ModInt t(rhs); return (*this).x != t.x; } inline ModInt operator++(int unused) { ModInt res((*this).x); ++(*this); return res; } inline ModInt& operator++() { (*this) += 1; return (*this); } inline ModInt operator--(int unused) { ModInt res((*this).x); --(*this); return res; } inline ModInt& operator--() { (*this) -= 1; return (*this); } inline ModInt operator+() const { return (*this); } inline ModInt operator-() const { return (*this).x ? ModInt(mod - (*this).x) : ModInt(0); } template<class T> int modpow(const T val, int p = mod - 2) { if (p == 0) return 1; if (p % 2) return (long long) val * modpow(val, p-1) % mod; long long t = modpow(val, p/2); int res = t * t % mod; return res; } operator int() const { return x; } friend ostream& operator<<(ostream& lhs, const ModInt& rhs) { lhs << rhs.x; return lhs; } friend istream& operator>>(istream& lhs, ModInt& rhs) { long long t; lhs >> t; rhs.x = t % mod; if (rhs.x < 0) rhs += mod; return lhs; } friend const ModInt operator+(const ModInt& lhs, const ModInt& rhs) {return ModInt(lhs) += rhs;} template<class T> friend const ModInt operator+(const ModInt& lhs, const T rhs) {return ModInt(lhs) += rhs;} template<class T> friend const ModInt operator+(T lhs, const ModInt& rhs) {return ModInt(lhs) += rhs;} friend const ModInt operator-(const ModInt& lhs, const ModInt& rhs) {return ModInt(lhs) -= rhs;} template<class T> friend const ModInt operator-(const ModInt& lhs, const T rhs) {return ModInt(lhs) -= rhs;} template<class T> friend const ModInt operator-(T lhs, const ModInt& rhs) {return ModInt(lhs) -= rhs;} friend const ModInt operator*(const ModInt& lhs, const ModInt& rhs) {return ModInt(lhs) *= rhs;} template<class T> friend const ModInt operator*(const ModInt& lhs, const T rhs) {return ModInt(lhs) *= rhs;} template<class T> friend const ModInt operator*(T lhs, const ModInt& rhs) {return ModInt(lhs) *= rhs;} friend const ModInt operator/(const ModInt& lhs, const ModInt& rhs) {return ModInt(lhs) /= rhs;} template<class T> friend const ModInt operator/(const ModInt& lhs, const T rhs) {return ModInt(lhs) /= rhs;} template<class T> friend const ModInt operator/(T lhs, const ModInt& rhs) {return ModInt(lhs) /= rhs;} template<class T> friend const int operator==(T lhs, const ModInt& rhs) {return ModInt(lhs) == rhs;} template<class T> friend const int operator!=(T lhs, const ModInt& rhs) {return ModInt(lhs) != rhs;} }; using modint = ModInt<1000000007>; //using modint = ModInt<998244353>; modint calc() { int N; cin >> N; map<int, int> A; for (int i = 0; i < N; i++) { int t; cin >> t; A[t]++; } if (N % 2) { if (A[0] != 1) return 0; } modint res = 1; for (int i = N-1; i > 0; i -= 2) { if (A[i] != 2) return 0; res *= 2; } return res; } int main() { cout << calc() << endl; } int main() { cout << calc() << endl; }
a.cc:210:5: error: redefinition of 'int main()' 210 | int main() | ^~~~ a.cc:205:5: note: 'int main()' previously defined here 205 | int main() | ^~~~
s435522992
p03846
C++
#include <bits/stdc++.h> using namespace std; int main(){ long int n; cin >> n; long long int a[n]; for(int i=0;i<n;i++)cin >>a[i]; sort(a,a+n); if (n%2==0){ if(a[0]!=1 || a[1]!=1)cout << 0 <<endl; else cout << pow(2,n/2)%1000000007<<endl; } else{ if(a[0]!=0)cout << 0 <<endl; else cout << pow(2,(n-1)/2)%1000000007<<endl; } }
a.cc: In function 'int main()': a.cc:12:28: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 12 | else cout << pow(2,n/2)%1000000007<<endl; | ~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double} a.cc:16:32: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 16 | else cout << pow(2,(n-1)/2)%1000000007<<endl; | ~~~~~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s424475725
p03846
C++
#include <iostream> #include <cmath> #define MOD = 10^9 + 7 int main() { int n; long long ans = (long long)1; cin >> n; vector<int> nums(n + 1, 0); for (int i = 0; i < n; i++) { int num; cin >> num; nums[num]++; } //validation if (n % 2 == 0) { for (int i = 1; i <=n; i++9) { if (i % 2 == 1 && nums[i] != 2) { cout << 0 << endl; return 0; } } } else { if (nums[0] != 1) { cout << 0 << endl; return 0; } for (int i = 1; i <=n; i++9) { if (i % 2 == 0 && nums[i] != 2) { cout << 0 << endl; return 0; } } } for (int i = 1; i <= n/2; i++) { ans ^= 2; ans %= MOD; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 10 | cin >> n; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:11:3: error: 'vector' was not declared in this scope 11 | vector<int> nums(n + 1, 0); | ^~~~~~ a.cc:11:10: error: expected primary-expression before 'int' 11 | vector<int> nums(n + 1, 0); | ^~~ a.cc:15:5: error: 'nums' was not declared in this scope; did you mean 'num'? 15 | nums[num]++; | ^~~~ | num a.cc:19:31: error: expected ')' before numeric constant 19 | for (int i = 1; i <=n; i++9) { | ~ ^ | ) a.cc:19:32: error: expected ';' before ')' token 19 | for (int i = 1; i <=n; i++9) { | ^ | ; a.cc:26:9: error: 'nums' was not declared in this scope 26 | if (nums[0] != 1) { | ^~~~ a.cc:27:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 27 | cout << 0 << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:27:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 27 | cout << 0 << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:31:31: error: expected ')' before numeric constant 31 | for (int i = 1; i <=n; i++9) { | ~ ^ | ) a.cc:31:32: error: expected ';' before ')' token 31 | for (int i = 1; i <=n; i++9) { | ^ | ; a.cc:4:13: error: expected primary-expression before '=' token 4 | #define MOD = 10^9 + 7 | ^ a.cc:43:12: note: in expansion of macro 'MOD' 43 | ans %= MOD; | ^~~ a.cc:45:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 45 | cout << ans << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:45:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 45 | cout << ans << endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s437633094
p03846
Java
import java.util.Arrays; public class Main { private static java.util.Scanner scanner = new java.util.Scanner(System.in); public static void main(String[] args) { int n = scanner.nextInt(), a[] = new int[(n + 1) / 2], max = 0; for (int i = 0, temp; i < n; i++) { if (((temp = scanner.nextInt()) & 1) == (n & 1)) { System.out.println(0); return; } a[(temp - (~n & 1)) / 2]++; max = Math.max(max, temp); } long ans = 1; if ((n & 1) == 1) a = Arrays.copyOfRange(a, 1, a.length); for (int i = 0; i < a.length; i++) { if (a[i] != 2) { System.out.println(0); return; } ans = ans * 2 % 1000000007; } Util.println(max, Arrays.toString(a), ans); } }
Main.java:28: error: cannot find symbol Util.println(max, Arrays.toString(a), ans); ^ symbol: variable Util location: class Main 1 error
s869977953
p03846
C++
#include<bits/stdc++.h> using namespace std; const int mod = 1e9+7; int a[1e5]; int solve(long long n){ int ans=1; sort( a, a+n ); if( (a[0] && n%2) || (a[0]==n%2 && n%2==0) ){ return 0; } if( a[0]==0 ){ a = a+1; n--; } for( int i=0; i<n; i+=2 ){ if( a[i]!=a[i+1] ) return 0; ans << 1; ans %= mod; } return ans; } int main(){ int N; cin >> N; for( int i=0; i<N; i++ ){ cin >> a[i]; } cout << solve(N) << endl; return 0; }
a.cc:5:7: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 5 | int a[1e5]; | ^~~ a.cc:5:7: error: could not convert '1.0e+5' from 'double' to 'long unsigned int' 5 | int a[1e5]; | ^~~ | | | double a.cc:5:7: error: size of array 'a' has non-integral type 'double' a.cc: In function 'int solve(long long int)': a.cc:16:7: error: incompatible types in assignment of 'int*' to 'int [1]' 16 | a = a+1; | ~~^~~~~
s132051635
p03846
C++
#include<iostream> #include<algorithm> using namespace std; const long long mod = 1e9+7; long long a[1e5]; long long solve(long long n){ long long ans=1LL; sort( a, a+n ); if( (a[0] && n%2) || (a[0]==n%2 && n%2==0) ){ return 0LL; } if( a[0]==0 ){ a = a+1; n--; } for( long long i=0LL; i<n; i+=2LL ){ if( a[i]!=a[i+1] ) return 0; ans << 1; ans %= mod; } return ans; } int main(){ long long N; cin >> N; for(long long i=0LL; i<N; i++){ cin >> a[i]; } cout << solve(N) << endl; return 0; }
a.cc:5:13: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 5 | long long a[1e5]; | ^~~ a.cc:5:13: error: could not convert '1.0e+5' from 'double' to 'long unsigned int' 5 | long long a[1e5]; | ^~~ | | | double a.cc:5:13: error: size of array 'a' has non-integral type 'double' a.cc: In function 'long long int solve(long long int)': a.cc:16:7: error: incompatible types in assignment of 'long long int*' to 'long long int [1]' 16 | a = a+1; | ~~^~~~~
s594249077
p03846
C++
#include<iostream> #include<algorithm> using namespace std; const long long mod = 1e9+7; long long a[1e5] long long solve(long long n){ long long ans=1LL; sort( a, a+n ); if( (a[0] && n%2) || (a[0]==n%2 && n%2==0) ){ return 0LL; } if( a[0]==0 ){ a = a+1; n--; } for( long long i=0LL; i<n; i+=2LL ){ if( a[i]!=a[i+1] ) return 0; ans << 1; ans %= mod; } return ans; } int main(){ long long N; cin >> N; for(long long i=0LL; i<N; i++){ cin >> a[i]; } cout << solve(N) << endl; return 0; }
a.cc:7:1: error: expected initializer before 'long' 7 | long long solve(long long n){ | ^~~~ a.cc: In function 'int main()': a.cc:33:12: error: 'a' was not declared in this scope 33 | cin >> a[i]; | ^ a.cc:36:11: error: 'solve' was not declared in this scope 36 | cout << solve(N) << endl; | ^~~~~
s844393735
p03846
C++
#include<iostream> #include<algorythm> using namespace std; const long long mod = 1e9+7; long long a[1e5] long long solve(long long n){ long long ans=1LL; sort( a, a+n ); if( (a[0] && n%2) || (a[0]==n%2 && n%2==0) ){ return 0LL; } if( a[0]==0 ){ a = a+1; n--; } for( long long i=0LL; i<n; i+=2LL ){ if( a[i]!=a[i+1] ) return 0; ans << 1; ans %= mod; } return ans; } int main(){ long long N; cin >> N; for(long long i=0LL; i<N; i++){ cin >> a[i]; } cout << solve(N) << endl; return 0; }
a.cc:2:9: fatal error: algorythm: No such file or directory 2 | #include<algorythm> | ^~~~~~~~~~~ compilation terminated.
s604978371
p03846
C++
#include<std/c++.h> using namespace std; const long long mod = 1e9+7; long long solve(long long n, vector<long long> a){ long long ans=1LL; sort( a.begin(), a.end() ); if( (a[0] && n%2) || (a[0]==n%2 && n%2==0) ){ return 0LL; } if( a[0]==0 ){ a.erase(a.begin()); n--; } for( long long i=0LL; i<n; i+=2LL ){ if( a[i]!=a[i+1] ) return 0; ans << 1; ans %= mod; } return ans; } int main(){ long long N; vector<long long> A; cin >> N; for(long long i=0LL; i<N; i++){ cin >> A[i]; } cout << solve(N, A) << endl; return 0; }
a.cc:1:9: fatal error: std/c++.h: No such file or directory 1 | #include<std/c++.h> | ^~~~~~~~~~~ compilation terminated.
s094079512
p03846
C
#include<stdio.h> #include<math.h> int main(){ int N; scanf("%d",&N); int A[N]; for(int i = 0;i < N;i++){ scanf("%d",&A[i]); } if(N % 2 == 0){ for(int i = 1;i < N;i += 2){ int cnt = 0; for(int j = 0;j < N;j++){ if(i == A[j]){ cnt++; } } if(cnt != 2){ printf("0"); return 0; } } }else{ for(int i = 0;i < N;i += 2){ int cnt = 0; for(int j = 0;j < N;j++){ if(i == A[j]){ cnt++; } } if(i == 0){ if(cnt != 1){ printf("0"); return 0; } }else{ if(cnt != 2){ printf("0"); return 0; } } } } if(N % 2 == 1){ N--; } float ans1 = pow(2,N / 2); int ans = ans1 % 1000000007; printf("%d",ans); return 0; }
main.c: In function 'main': main.c:48:18: error: invalid operands to binary % (have 'float' and 'int') 48 | int ans = ans1 % 1000000007; | ^
s095959105
p03846
C++
//file_name:ABC50_C.cpp #include <bits/stdc++.h> #define fi first #define se second #define rep(i,n) for(int i = 0; i < (n); ++i) #define rrep(i,n) for(int i = 1; i <= (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define rng(a) a.begin(),a.end() #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define limit(x,l,r) max(l,min(x,r)) #define lims(x,l,r) (x = max(l,min(x,r))) #define isin(x,l,r) ((l) <= (x) && (x) < (r)) #define pb push_back #define sz(x) (int)(x).size() #define pcnt __builtin_popcountll #define uni(x) x.erase(unique(rng(x)),x.end()) #define snuke srand((unsigned)clock()+(unsigned)time(NULL)); #define show(x) cout<<#x<<" = "<<x<<endl; #define PQ(T) priority_queue<T,v(T),greater<T> > #define bn(x) ((1<<x)-1) #define dup(x,y) (((x)+(y)-1)/(y)) #define newline puts("") #define v(T) vector<T> #define vv(T) v(v(T)) using namespace std; typedef long long int ll; typedef unsigned uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<P> vp; inline int in() { int x; scanf("%d",&x); return x;} template<typename T>inline istream& operator>>(istream&i,v(T)&v) {rep(j,sz(v))i>>v[j];return i;} template<typename T>string join(const v(T)&v) {stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);} template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v) {if(sz(v))o<<join(v);return o;} template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v) {return i>>v.fi>>v.se;} template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v) {return o<<v.fi<<","<<v.se;} template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;} const double eps = 1e-10; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; #define dame { puts("-1"); return 0;} #define yn {puts("Yes");}else{puts("No");} const int MX = 200005; // int scan /* int x; scanf("%d",&x); int y; scanf("%d",&y); int z; scanf("%d",&z); // matrix scan /* ll a[n] = {}; rep(i,n){ scanf("%lld",&a[i]); } */ // string scan /* string s; cin >> s; */ int main() { int n; scanf("%d",&n); ll a[n] = {}; rep(i,n){ scanf("%lld",&a[i]); } sort(a,a+n); ll ans = 1; if(n%2==0){ rep(i,n/2){ if(a[i*2]==i*2+1&&a[i*2+1]==i*2+1){ ans*=2; ans %= 1000000007; }else{ ans = 0; break; } } }else{ if(a[0]!=0){ ans = 0; break; } rep(i,n/2){ if(a[(i+1)*2-1]==(i+1)*2&&a[(i+1)*2]==(i+1)*2){ ans*=2; ans %= 1000000007; }else{ ans = 0; break } } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:102:13: error: break statement not within loop or switch 102 | break; | ^~~~~ a.cc:110:22: error: expected ';' before '}' token 110 | break | ^ | ; 111 | } | ~
s848492019
p03846
C++
#include <iostream> #include <algorithm> #include <cstring> #include <string> #include <cmath> #define ll long long #define MOD 1e9+7 ll a[100005]; using namespace std; int main(){ ll n; cin>>n; ll flag=1;//标志 ll ans=1; if(n%2==0){ //偶数 for(ll i=0;i<n;i++){ ll x; cin>>x; a[x]++; if(x>=n || x%2==0 || a[x]>2){ flag=0; cout<<"0"<<endl; break; } if(a[x]==1) ans=ans*2%MOD; } } else{ //奇数 for(ll i=0;i<n;i++){ ll x; cin>>x; a[x]++; if(x>=n || x%2==1 || a[0]>1 ||a[x]>2){ flag=0; cout<<"0"<<endl; break; } 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:29:42: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 29 | ans=ans*2%MOD; | ~~~~~^ | | | long long int a.cc:44:42: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 44 | ans=ans*2%MOD; | ~~~~~^ | | | long long int
s930055359
p03846
C++
#include <stdio.h> #include <math.h> #include <string.h> #include <algorithm> #include <iostream> #include <string> #include <time.h> #include <queue> #include <string.h> #define sf scanf #define pf printf #define lf double #define ll long long #define p123 printf("123\n"); #define pn printf("\n"); #define pk printf(" "); #define p(n) printf("%d",n); #define pln(n) printf("%d\n",n); #define s(n) scanf("%d",&n); #define ss(n) scanf("%s",n); #define ps(n) printf("%s",n); #define sld(n) scanf("%lld",&n); #define pld(n) printf("%lld",n); #define slf(n) scanf("%lf",&n); #define plf(n) printf("%lf",n); #define sc(n) scanf("%c",&n); #define pc(n) printf("%c",n); #define gc getchar(); #define re(n,a) memset(n,a,sizeof(n)); #define len(a) strlen(a) #define LL long long #define eps 1e-6 using namespace std; int a[10001000]; const ll mod = 1e9 + 7; // 快速幂 (a^b)%mod // 如果求逆元,则b = mod-2; ll pow_quick(ll a, ll b) { ll r = 1, base = a; while (b) { if (b & 1) { r *= base; r %= mod;
a.cc: In function 'long long int pow_quick(long long int, long long int)': a.cc:43:16: error: expected '}' at end of input 43 | r %= mod; | ^ a.cc:41:16: note: to match this '{' 41 | if (b & 1) { | ^ a.cc:43:16: error: expected '}' at end of input 43 | r %= mod; | ^ a.cc:40:13: note: to match this '{' 40 | while (b) { | ^ a.cc:43:16: error: expected '}' at end of input 43 | r %= mod; | ^ a.cc:38:26: note: to match this '{' 38 | ll pow_quick(ll a, ll b) { | ^ a.cc:43:16: warning: no return statement in function returning non-void [-Wreturn-type] 43 | r %= mod; | ^
s512470411
p03846
C++
#include<bits/stdc++.h> #include<queue> #define REP(i,a) for(int (i)=0; (i)<(a); (i)++) using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); long long int N,ans; bool flag =true; cin>>N; int A[N],B[N]={}; REP(i,N){ cin>>A[i]; B[A[i]]++; if(B[A[i]]>=3) flag=false; } if(B[0]>=2)flag=false; //真ん中が二人いるのはおかしい //N偶数の時はN-1,N-3,...,3,1,1,3,...,N-3,N-1 //N奇数の時はN-1,N-3,...,2,0,2,4,...,N-3,N-1 if(N%2==0){ ans=pow(2,(N/2)); }else{ ans=pow(2,(N-1)/2); } ans=ans%(pow(10,9)+7); if(!flag)cout<<"0"; else cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:29:10: error: invalid operands of types 'long long int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 29 | ans=ans%(pow(10,9)+7); | ~~~^~~~~~~~~~~~~~ | | | | long long int __gnu_cxx::__promote<double>::__type {aka double}
s812442932
p03846
C++
#include<bits/stdc++.h> #include<queue> #define REP(i,a) for(int (i)=0; (i)<(a); (i)++) using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int N,ans; bool flag =true; cin>>N; int A[N],B[N]={}; REP(i,N){ cin>>A[i]; B[A[i]]++; if(B[A[i]]>=3) flag=false; } if(B[0]>=2)flag=false; //真ん中が二人いるのはおかしい //N偶数の時はN-1,N-3,...,3,1,1,3,...,N-3,N-1 //N奇数の時はN-1,N-3,...,2,0,2,4,...,N-3,N-1 if(N%2==0){ ans=pow(2,(N/2)); }else{ ans=pow(2,(N-1)/2); } ans=ans%(pow(10,9)+7); if(!flag)cout<<"0"; else cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:29:10: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 29 | ans=ans%(pow(10,9)+7); | ~~~^~~~~~~~~~~~~~ | | | | int __gnu_cxx::__promote<double>::__type {aka double}
s979981772
p03846
C++
#include<bits/stdc++.h> #include<queue> #define REP(i,a) for(int (i)=0; (i)<(a); (i)++) using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int N,ans; bool flag =true; cin>>N; int A[N],B[N]={}; REP(i,N){ cin>>A[i]; B[A[i]]++; if(B[A[i]]>=3) flag=false; } if(B[0]>=2)flag=false; //真ん中が二人いるのはおかしい //N偶数の時はN-1,N-3,...,3,1,1,3,...,N-3,N-1 //N奇数の時はN-1,N-3,...,2,0,2,4,...,N-3,N-1 if(N%2==0){ ans=pow(2,(N/2)); }else{ ans=pow(2,(N-1)/2); } if(!flag)cout<<"0"; else cout<<ans%(pow(10,9)+7); return 0; }
a.cc: In function 'int main()': a.cc:31:17: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 31 | else cout<<ans%(pow(10,9)+7); | ~~~^~~~~~~~~~~~~~ | | | | int __gnu_cxx::__promote<double>::__type {aka double}
s814695973
p03846
C++
#include <iostream># {{{ using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; #include <string> #include <cstdio> #include <algorithm> #include <vector> #include <cmath> #include <climits> #include <bitset> #include <array> #include <deque> #include <queue> #include <map> #define all(x) (x).begin(),(x).end() const int MOD = 1e9 + 7;# }}} void solve(){ } int main(){ int N; cin >> N; vector<int> a(N); vector<int> cnt(N); for (int i = 0; i < N; i++){ cin >> a[i]; cnt[a[i]]++; } bool ok = true; if (N % 2 == 0){ if (cnt[0] != 0) { ok = false; } for (int i = 1; i < N; i += 2){ if (cnt[i] != 2){ ok = false; break; } } } else { if (cnt[0] != 1) { ok = false; } for (int i = 2; i < N; i += 2) { if (cnt[i] != 2) { ok = false; break; } } } ll ans; if (ok) { ans = 1; for (int i = 0; i < N/2; i++){ ans *= 2; ans %= MOD; } } else { ans = 0; } cout << ans << endl; return 0; }
a.cc:1:20: warning: extra tokens at end of #include directive 1 | #include <iostream># {{{ | ^ a.cc:20:25: error: stray '#' in program 20 | const int MOD = 1e9 + 7;# }}} | ^ a.cc:20:27: error: expected declaration before '}' token 20 | const int MOD = 1e9 + 7;# }}} | ^ a.cc:20:28: error: expected declaration before '}' token 20 | const int MOD = 1e9 + 7;# }}} | ^ a.cc:20:29: error: expected declaration before '}' token 20 | const int MOD = 1e9 + 7;# }}} | ^
s503599887
p03846
C++
#include <iostream># {{{ using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; #include <string> #include <cstdio> #include <algorithm> #include <vector> #include <cmath> #include <climits> #include <bitset> #include <array> #include <deque> #include <queue> #include <map> #define all(x) (x).begin(),(x).end() const int MOD = 1e9 + 7;# }}} void solve(){ } int main(){ int N; cin >> N; vector<int> a(N); vector<int> cnt(N); for (int i = 0; i < N; i++){ cin >> a[i]; cnt[a[i]]++; } bool ok = true; if (N % 2 == 0){ if (cnt[0] != 0) { ok = false; } for (int i = 1; i < N; i += 2){ if (cnt[i] != 2){ ok = false; break; } } } else { if (cnt[0] != 1) { ok = false; } for (int i = 2; i < N; i += 2) { if (cnt[i] != 2) { ok = false; break; } } } ll ans; if (ok) { ans = 1; for (int i = 0; i < N/2; i++){ ans *= 2; ans %= MOD; } } else { ans = 0; } cout << ans << endl; return 0; }
a.cc:1:20: warning: extra tokens at end of #include directive 1 | #include <iostream># {{{ | ^ a.cc:20:25: error: stray '#' in program 20 | const int MOD = 1e9 + 7;# }}} | ^ a.cc:20:27: error: expected declaration before '}' token 20 | const int MOD = 1e9 + 7;# }}} | ^ a.cc:20:28: error: expected declaration before '}' token 20 | const int MOD = 1e9 + 7;# }}} | ^ a.cc:20:29: error: expected declaration before '}' token 20 | const int MOD = 1e9 + 7;# }}} | ^
s936139304
p03846
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM 1000000000; #define mod MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 1000000005 #define NIL -1 int main(){ ll n; cin >> n; bool flg = true; ll ans = 1; vector<ll> a(n); for(ll i = 0; i < n; i++){ cin >> a[i]; } sort(a, a + n); if(n%2 && a[0]) flg = false; if(n%2) a.erase(a.begin()); for(ll i = 0; i < a.size(); i += 2){ if(a[i] != a[i+1] || a[i] != i+1+n%2){ flg = false; } } if(flg){ for(int i = 0; i < n/2; i++){ ans *= 2; ans %= mod; } } else { ans = 0; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:18:15: error: no match for 'operator+' (operand types are 'std::vector<long long int>' and 'll' {aka 'long long int'}) 18 | sort(a, a + n); | ~ ^ ~ | | | | | ll {aka long long int} | std::vector<long long int> 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:18:17: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'll' {aka 'long long int'} 18 | sort(a, a + n); | ^ /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:18:17: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'll' {aka 'long long int'} 18 | sort(a, a + n); | ^ 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:18:17: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 18 | sort(a, a + n); | ^ /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:18:17: note: mismatched types 'const _CharT*' and 'std::vector<long long int>' 18 | sort(a, a + n); | ^ /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:18:17: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'll' {aka 'long long int'} 18 | sort(a, a + n); | ^ /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:18:17: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 18 | sort(a, a + n); | ^ /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:18:17: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 18 | sort(a, a + n); | ^ /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:18:17: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 18 | sort(a, a + n); | ^ /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:18:17: note: 'std::vector<long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 18 | sort(a, a + n); | ^ /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:18:17: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 18 | sort(a, a + n); | ^ /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:18:17: note: mismatched types 'const _CharT*' and 'std::vector<long long int>' 18 | sort(a, a + n); | ^ /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:18:17: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'll' {aka 'long long int'} 18 | sort(a, a + n); | ^ /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:18:17: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 18 | sort(a, a + n); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:18:17: note: 'std::vector<long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 18 | sort(a, a + n); | ^ 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:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed: a.cc:18:17: note: 'std::vector<long long int>' is not derived from 'const std::complex<_Tp>' 18 | sort(a, a + n)
s408654383
p03846
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM 1000000000; #define mod MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 1000000005 #define NIL -1 int main(){ ll n; cin >> n; bool flg = true; ll ans = 1; ll a[n]; for(ll i = 0; i < n; i++){ cin >> a[i]; } sort(a, a + n); if(n%2 && a[0]) flg = false; if(n%2) a.erase(a.begin()); for(ll i = 0; i < a.size(); i += 2){ if(a[i] != a[i+1] || a[i] != i+1+n%2){ flg = false; } } if(flg){ for(int i = 0; i < n/2; i++){ ans *= 2; ans %= mod; } } else { ans = 0; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:20:15: error: request for member 'erase' in 'a', which is of non-class type 'll [n]' {aka 'long long int [n]'} 20 | if(n%2) a.erase(a.begin()); | ^~~~~ a.cc:20:23: error: request for member 'begin' in 'a', which is of non-class type 'll [n]' {aka 'long long int [n]'} 20 | if(n%2) a.erase(a.begin()); | ^~~~~ a.cc:21:25: error: request for member 'size' in 'a', which is of non-class type 'll [n]' {aka 'long long int [n]'} 21 | for(ll i = 0; i < a.size(); i += 2){ | ^~~~
s316389923
p03846
C++
#include <bits/stdc++.h> #define MOD 1000000007 template<typename T> T power(T a, T b) { T res = 1; while(b > 0) { if(b & 1) res = res * a % MOD; a = a * a % MOD; b >>= 1; } return res; } using namespace std; int main() { long N; long A[100001]; map<long, long> count; cin >> N; for(long i = 1; i <= N; ++i) { cin >> A[i]; count[A[i]]++; } if(N % 2 == 1) { if(count[0] != 1) goto fail; for(long i = 1; i < N; i++) { if(i % 2 == 1) { if(count[i] != 0) goto fail; } else { if(count[i] != 2) goto fail; } } } else { for(long i = 0; i < N; ++i) { if(i % 2 == 1) { if(count[i] != 2) goto fail; } else { if(count[i] != 0) goto fail; } } } cout << (N % 2 == 1 ? power(long(2), (N-1)/2) : power(long(2), (N/2))) << endl; return 0; fail: cout << 0 << endl; return 0;
a.cc: In function 'int main()': a.cc:58:14: error: expected '}' at end of input 58 | return 0; | ^ a.cc:20:1: note: to match this '{' 20 | { | ^
s853595432
p03846
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM = 1000000000; #define mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 100005 #define NIL -1 int main(){ ll n; cin >> n; ll a[n]; map<ll, int> mp; ll ans = 0; for(ll i = 0; i < n; i++){ cin >> a[i]; mp[a[i]]++; } sort(a, a+n); bool flag = true; if(n%2 == 0){ for(ll i = 0; i < n; i+2){ if(mp[a[i]] != 2){ flag = false; } } } else { if(a[0] == 0){ for(ll i = 2; i < n; i++){ if(mp[a[i]] != 2){ flag = false; } } } } if(flag){ ans = 1; for(ll i = 1; i < n/2; i++){ ans *= 2; ans %= mod; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:5:13: error: expected primary-expression before '=' token 5 | #define mod = MM + 7; | ^ a.cc:40:20: note: in expansion of macro 'mod' 40 | ans %= mod; | ^~~ a.cc:4:12: error: expected primary-expression before '=' token 4 | #define MM = 1000000000; | ^ a.cc:5:15: note: in expansion of macro 'MM' 5 | #define mod = MM + 7; | ^~ a.cc:40:20: note: in expansion of macro 'mod' 40 | ans %= mod; | ^~~
s377087814
p03846
C++
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UncheckedIOException; import java.util.StringTokenizer; class Main{ public static void main(String[] args) { SC sc=new SC(System.in); int N=sc.nextInt(); int syurui=(N+1)/2; int[] kosu=new int[syurui]; if(N%2==0) { for(int i=0; i<N; i++) { kosu[sc.nextInt()/2]++; } } else if(N%2==1) { for(int i=0; i<N; i++) { kosu[(sc.nextInt()-1)/2]++; } } for(int i=0; i<(N+1)/2; i++) { if(N%2==0) { if(kosu[i]!=2) { System.out.println("0"); System.exit(0); } } else { if(i>0) { if(kosu[i]!=2) { System.out.println("0"); System.exit(0); } } } } long a=1; for(int i=0; i<N/2; i++) { a*=2; a%=1000000007; } System.out.println(a); } static class SC { private BufferedReader reader = null; private StringTokenizer tokenizer = null; public SC(InputStream in) { reader = new BufferedReader(new InputStreamReader(in)); } public String next() { if (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new UncheckedIOException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.BufferedReader; | ^~~~~~ 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.IOException; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.io.InputStream; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.io.InputStreamReader; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import java.io.UncheckedIOException; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import java.util.StringTokenizer; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:9:15: error: expected ':' before 'static' 9 | public static void main(String[] args) { | ^~~~~~~ | : a.cc:9:33: error: 'String' has not been declared 9 | public static void main(String[] args) { | ^~~~~~ a.cc:9:42: error: expected ',' or '...' before 'args' 9 | public static void main(String[] args) { | ^~~~ a.cc:52:24: error: expected ':' before 'BufferedReader' 52 | private BufferedReader reader = null; | ^~~~~~~~~~~~~~~ | : a.cc:52:25: error: 'BufferedReader' does not name a type 52 | private BufferedReader reader = null; | ^~~~~~~~~~~~~~ a.cc:54:24: error: expected ':' before 'StringTokenizer' 54 | private StringTokenizer tokenizer = null; | ^~~~~~~~~~~~~~~~ | : a.cc:54:25: error: 'StringTokenizer' does not name a type 54 | private StringTokenizer tokenizer = null; | ^~~~~~~~~~~~~~~ a.cc:55:23: error: expected ':' before 'SC' 55 | public SC(InputStream in) { | ^~~ | : a.cc:55:38: error: expected ')' before 'in' 55 | public SC(InputStream in) { | ~ ^~~ | ) a.cc:58:23: error: expected ':' before 'String' 58 | public String next() { | ^~~~~~~ | : a.cc:58:24: error: 'String' does not name a type 58 | public String next() { | ^~~~~~ a.cc:68:23: error: expected ':' before 'int' 68 | public int nextInt() { | ^~~~ | : a.cc:71:23: error: expected ':' before 'long' 71 | public long nextLong() { | ^~~~~ | : a.cc:74:10: error: expected ';' after class definition 74 | } | ^ | ; a.cc:50:9: error: a storage class can only be specified for objects and functions 50 | static class SC { | ^~~~~~ a.cc:75:2: error: expected ';' after class definition 75 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:10:30: error: 'System' was not declared in this scope 10 | SC sc=new SC(System.in); | ^~~~~~ a.cc:13:20: error: structured binding declaration cannot have type 'int' 13 | int[] kosu=new int[syurui]; | ^~ a.cc:13:20: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:13:20: error: empty structured binding declaration a.cc:13:23: error: expected initializer before 'kosu' 13 | int[] kosu=new int[syurui]; | ^~~~ a.cc:16:33: error: 'kosu' was not declared in this scope 16 | kosu[sc.nextInt()/2]++; | ^~~~ a.cc:22:33: error: 'kosu' was not declared in this scope 22 | kosu[(sc.nextInt()-1)/2]++; | ^~~~ a.cc:28:36: error: 'kosu' was not declared in this scope 28 | if(kosu[i]!=2) { | ^~~~ a.cc:35:44: error: 'kosu' was not declared in this scope 35 | if(kosu[i]!=2) { | ^~~~ a.cc: In member function 'int Main::SC::nextInt()': a.cc:69:32: error: 'Integer' was not declared in this scope 69 | return Integer.parseInt(next()); | ^~~~~~~ a.cc:69:49: error: 'next' was not declared in this scope; did you mean 'nextInt'? 69 | return Integer.parseInt(next()); | ^~~~ | nextInt a.cc: In member function 'long int Main::SC::nextLong()': a.cc:72:32: error: 'Long' was not declared in this scope; did you mean 'long'? 72 | return Long.parseLong(next()); | ^~~~ | long a.cc:72:47: error: 'next' was not declared in this scope; did you mean 'nextInt'? 72 | return Long.parseLong(next()); | ^~~~ | nextInt
s619935810
p03846
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int ans = 0; bool check=false; int a[n]; for (int i=0; i<n; i++) { cin>>a[i]; } sort(a,a+n); if(n%2==1){ //奇数個(中央0) for(int i=0;i<=n/2;i++){ if(a[0]!=0){ break; } if(i>0){ if(a[i*2-1]!=i*2||a[i*2-1]!=a[i*2]) break; } if(i==n/2){ check=true; } } } else{ for(int i=0;i<n/2-1;i++){ if(a[i*2]!=i*2+1||a[i*2]!=a[i*2+1]){ break; } if(i==n/2-2){ check=true; } } } cout << (check?(pow(2,n/2)%(1e9+7)):0) << endl; }
a.cc: In function 'int main()': a.cc:43:35: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'double' to binary 'operator%' 43 | cout << (check?(pow(2,n/2)%(1e9+7)):0) << endl; | ~~~~~~~~~~^~~~~~~~ | | | | | double | __gnu_cxx::__promote<double>::__type {aka double}
s800293896
p03846
C++
N = int(input()) A = [int(x) for x in input().split()] if not N%2: result = 2**(N/2) A.sort() for i in range(0,N-1,2): if A[i] != A[i+1]: result = 0 else: result = 2**(N/2 - 1) for i in range(1,N,2): if A[i] != A[i+1]: result = 0 print(int(result))
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s801818951
p03846
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,a[100001],temp,flag,mod=(ll)1e9+7; int main(void){ cin>>n; for(int i=0;i<n;i++){ cin>>temp; a[temp]++; } if((n+1) % 2 == 0){ if(a[0] != 1)flag=1; for(int i=1;i<n/2+1;i++){ if(a[i*2] != 2)flag=1; if(a[i*2-1] != 0)flag=1; } if(flag)cout<<0<<endl; else cout<<pow(2,n/2)%mod<<endl; } else{ for(int i=1;i<n/2+1;i++){ if(a[i*2-1] != 2)flag=1; if(a[i*2] != 0)flag=1; } if(flag)cout<<0<<endl; else cout<<pow(2,n/2)%mod<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:21:30: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'll' {aka 'long long int'} to binary 'operator%' 21 | else cout<<pow(2,n/2)%mod<<endl; | ~~~~~~~~~~^~~~ | | | | | ll {aka long long int} | __gnu_cxx::__promote<double>::__type {aka double} a.cc:29:30: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'll' {aka 'long long int'} to binary 'operator%' 29 | else cout<<pow(2,n/2)%mod<<endl; | ~~~~~~~~~~^~~~ | | | | | ll {aka long long int} | __gnu_cxx::__promote<double>::__type {aka double}
s786601560
p03846
C++
#include<iostream> using namespace std; int main() { long long N; cin >> N; long long A[N]; for (long long i = 0; i < N; i++) { cin >> A[i]; } long long cnt[N + 1] = {}; bool flg = true; for (long long i = 0; i < N; i++) { int j = A[i]; cnt[j]++; } for (long long i = 0; i < N; i++) { if (cnt[0] >= 2) { flg = false; } if (i != 0) { if (cnt[i] % 2 != 0) { flg = false; } } if (cnt[i] >= 3) { flg = false; } if (!flg) { cout << "0" << endl; return 0; } } int ans = 1; if (N % 2 == 0) { if (cnt[0] != 0) { cout << 0 << endl; return 0; } for (long long i = 0; i < N / 2; i++) { ans = ans*2; ans %= (1e9 + 7); } } else { for (long long i = 0; i < (N-1) / 2; i++) { ans = ans*2; ans %= (1e9 + 7); } } cout <<ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:43:29: error: invalid operands of types 'int' and 'double' to binary 'operator%' 43 | ans %= (1e9 + 7); | ~~~~^~~~~~~~~~~~ a.cc:43:29: note: in evaluation of 'operator%=(int, double)' a.cc:50:29: error: invalid operands of types 'int' and 'double' to binary 'operator%' 50 | ans %= (1e9 + 7); | ~~~~^~~~~~~~~~~~ a.cc:50:29: note: in evaluation of 'operator%=(int, double)'
s242858248
p03846
C++
#include<iostream> using namespace std; int main() { long long N; cin >> N; long long A[N]; for (long long i = 0; i < N; i++) { cin >> A[i]; } long long cnt[N + 1] = {}; bool flg = true; for (long long i = 0; i < N; i++) { int j = A[i]; cnt[j]++; } for (long long i = 0; i < N; i++) { if (cnt[0] >= 2) { flg = false; } if (i != 0) { if (cnt[i] % 2 != 0) { flg = false; } } if (cnt[i] >= 3) { flg = false; } if (!flg) { cout << "0" << endl; return 0; } } long long ans = 1; if (N % 2 == 0) { if (cnt[0] != 0) { cout << 0 << endl; return 0; } for (long long i = 0; i < N / 2; i++) { ans = ans*2; ans %= (1e9 + 7); } } else { for (long long i = 0; i < (N-1) / 2; i++) { ans = ans*2; ans %= (1e9 + 7); } } cout <<ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:43:29: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 43 | ans %= (1e9 + 7); | ~~~~^~~~~~~~~~~~ a.cc:43:29: note: in evaluation of 'operator%=(long long int, double)' a.cc:50:29: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 50 | ans %= (1e9 + 7); | ~~~~^~~~~~~~~~~~ a.cc:50:29: note: in evaluation of 'operator%=(long long int, double)'
s355226729
p03846
C++
#include<iostream> #include<vector> #include<cstdio> #include<cstring> #include<algorithm> #include<string> #include<bits/stdc++.h> #define ll long long using namespace std; int main(){ int n; cin >> n; ll ans; int n_div = n/2; vector<int> a(0); int s; int count = 0; for(int i = 1; i <= n; i++){ cin >> s; a.push_back(s); } sort(a.begin(), a.end(), greater<int>()); for(int i = 0; 1 < a.size(); i+0){ if(a[0] == a[1]){ a.erase(a.begin()); a.erase(a.begin()); } else { ans = 0; break; } } if(a.size() == 1 && a[0] == 0){ ans = pow(2, n_div); } else if(a.size() == 0){ ans = pow(2, n_div); } if(ans == 0){ cout << 0 << endl; } else { cout << ans % (pow(10, 9) + 7) << endl; } }
a.cc: In function 'int main()': a.cc:41:17: error: invalid operands of types 'long long int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 41 | cout << ans % (pow(10, 9) + 7) << endl; | ~~~ ^ ~~~~~~~~~~~~~~~~ | | | | long long int __gnu_cxx::__promote<double>::__type {aka double}
s718846053
p03846
C++
#include<bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; long long A[N]; for (long long i = 0; i < N; i++) { cin >> A[i]; } long long cnt[N] = {}; bool flg = true; for (long long i = 0; i < N; i++) { cnt[A[i]]++; } for (long long i = 0; i < N; i++) { if (cnt[0] >= 2) { flg = false; } if (i != 0) { if (cnt[i] % 2 != 0) { flg = false; } } if (cnt[i] >= 3) { flg = false; } if (!flg) { cout << 0 << endl; return 0; } } long long ans = 1; if (N % 2 == 0) { for (long long i = 0; i < N / 2; i++) { ans *= 2; } } else { for (long long i = 0; i < (N-1) / 2; i++) { ans *= 2; } } cout << ans % (1e9 + 7); return 0; }
a.cc: In function 'int main()': a.cc:44:21: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 44 | cout << ans % (1e9 + 7); | ~~~ ^ ~~~~~~~~~ | | | | | double | long long int
s507920692
p03846
C++
#include<bits/stdc++.h> using namespace std; int main() { int N; cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; } int cnt[N] = {}; bool flg = true; for (int i = 0; i < N; i++) { cnt[A[i]]++; } for (int i = 0; i < N; i++) { if (A[0] >= 2) { flg = false; } if (i != 0) { if (A[i] % 2 != 0) { flg = false; } } if (!flg) { cout << 0 << endl; return 0; } } int ans = 1; if (N % 2 == 0) { for (int i = 0; i < N / 2; i++) { ans *= 2; } } else { for (int i = 0; i < (N-1) / 2; i++) { ans *= 2; } } cout << ans % (1e9 + 7) << endl; }
a.cc: In function 'int main()': a.cc:7:24: error: 'A' was not declared in this scope 7 | cin >> A[i]; | ^ a.cc:12:21: error: 'A' was not declared in this scope 12 | cnt[A[i]]++; | ^ a.cc:15:21: error: 'A' was not declared in this scope 15 | if (A[0] >= 2) { | ^ a.cc:19:29: error: 'A' was not declared in this scope 19 | if (A[i] % 2 != 0) { | ^ a.cc:39:21: error: invalid operands of types 'int' and 'double' to binary 'operator%' 39 | cout << ans % (1e9 + 7) << endl; | ~~~ ^ ~~~~~~~~~ | | | | int double
s498265580
p03846
C++
#include<iostream> #include<string> #include<algorithm> #include<vector> using namespace std; int main() { int N; int count; int answer=1; bool can = true; vector<int> A(10000); cin >> N; for (int i = 1; i < N + 1; ++i) cin >> A[i]; if (N % 2 == 0) {//Nが偶数の場合 //並びがありうるかどうかの確認 for (int j = 1; j < N ; j=j+2) { count = 0; for (int i = 1; i < N + 1; ++i) { if (j == A[i]) { count++; } } if (count == 2) { can = can & true; } else { can = false; } } for (int i = 0; i < N / 2; ++i) { answer *= 2; } answer = pow(2, N / 2); answer = answer % 1000000007; if (can) { cout << answer << endl; }else { cout << 0 << endl; } } else {//Nが奇数の場合 //並びがありうるかどうかの確認 count = 0; for (int i = 1; i < N + 1; ++i) { if (0 == A[i]) { count++; } } if (count == 1) { can = can & true; } for (int j = 2; j < N+1; j = j + 2) { count = 0; for (int i = 1; i < N + 1; ++i) { if (j == A[i]) { count++; } } if (count == 2) { can = can & true; }else{ can = false; } } for (int i = 0; i < N / 2; ++i) { answer *= 2; } answer= answer % 1000000007; if (can) { cout << answer << endl; } else { cout << 0 << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:40:26: error: 'pow' was not declared in this scope 40 | answer = pow(2, N / 2); | ^~~
s588797074
p03846
C++
#include<iostream> #include<string> #include<algorithm> #include<vector> using namespace std; int main() { int N; int count; int answer; bool can = true; vector<int> A(10000); cin >> N; for (int i = 1; i < N + 1; ++i) cin >> A[i]; if (N % 2 == 0) {//Nが偶数の場合 //並びがありうるかどうかの確認 for (int j = 1; j < N ; j=j+2) { count = 0; for (int i = 1; i < N + 1; ++i) { if (j == A[i]) { count++; } } if (count == 2) { can = can & true; } else { can = false; } } answer = pow(2, N / 2); answer = answer % 1000000007; if(can) cout << answer << endl; } else {//Nが奇数の場合 //並びがありうるかどうかの確認 count = 0; for (int i = 1; i < N + 1; ++i) { if (0 == A[i]) { count++; } } if (count == 1) { can = can & true; } for (int j = 2; j < N+1; j = j + 2) { count = 0; for (int i = 1; i < N + 1; ++i) { if (j == A[i]) { count++; } } if (count == 2) { can = can & true; }else{ can = false; } } answer = pow(2, N / 2); answer= answer % 1000000007; if (can) { cout << answer << endl; } else { cout << 0 << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:37:26: error: 'pow' was not declared in this scope 37 | answer = pow(2, N / 2); | ^~~ a.cc:69:26: error: 'pow' was not declared in this scope 69 | answer = pow(2, N / 2); | ^~~
s534253741
p03846
C++
#include <iostream> #include <vector> #include <unordered_map> #include <algorithm> using namespace std; int mkhash(vector<int> v) { int h = 0; for (int i = 0; i < v.size(); i++) { h += v[i] * pow(10, i); } return h; } int main(int argc, char const* argv[]) { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } vector<int> O(N); for (int i = 0; i < N; i++) { O[i] = i; } int total = 0; unordered_map<int, int> cache; do { vector<int> T(N); for (int i = 0; i < N; i++) { T[i] = A[O[i]]; } int h = mkhash(T); if (cache[h] == 1) { continue; } if (cache[h] == 2) { ++total; continue; } bool yes = true; for (int i = 0; i < N; i++) { if (T[i] != abs(N - i - 1 - i)) { yes = false; cache[h] = 1; break; } } if (yes) { cache[h] = 2; ++total; } } while (next_permutation(O.begin(), O.end())); cout << total << endl; return 0; }
a.cc: In function 'int mkhash(std::vector<int>)': a.cc:10:21: error: 'pow' was not declared in this scope 10 | h += v[i] * pow(10, i); | ^~~
s439212600
p03846
C++
8 7 5 1 1 7 3 5 3
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 8 | ^
s968531437
p03846
C++
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5+100; const long long Mod = 1e9+7; long long ans, a, t[maxn],n; int main(){ cin >> n; for(int i=0; i<n; i++){ cin >> a; t[a]++; } ans = 1; if(n%2 == 1){ for(int i=0; i<n; i+=2){ if((i!=0 && t[i]!=2) || (i==0 && t[i]!=1)){ cout << 0; return 0; } if(i!=0) ans = (ans*2) % Mod; } cout << ans; } else{ for(int i=1; i<n; i+=2){ if(t[i]!=2){ cout << 0; return 0; } ans = (ans*2)%Mod; } count << ans; } }
a.cc: In function 'int main()': a.cc:34:15: error: invalid operands of types '<unresolved overloaded function type>' and 'long long int' to binary 'operator<<' 34 | count << ans; | ~~~~~~^~~~~~
s133362193
p03846
C
#include<stdio.h> #include<math.h> int main(){ long n; scanf(“%d”,&n); long a[n]; int ans=1; for(long i=0;i<n;i++){ scanf(“%d”,&a[i]); } long temp; for(long i=0;i<n;i++){//sort for(long j=i+1;j<n;j++){ if(a[i]>a[j]){ temp=a[j]; a[j]=a[i]; a[i]=temp; } } } for(long i=0;i<n;i+=2){ if(a[i]!=i+1-n%2){ ans=0; break; } } if(ans==0){ printf(“%d\n”,ans); }else{ long x=pow(10,9)+7; unsigned long y; if(n>pow(10,3)){ y=pow(2,(n-500-n%2)/2); y=y%x; x=(long)pow(2,250)%x; y=y*x; }else{ y=pow(2,(n-n%2)/2); y=y%x; } printf(“%ld\n”,y); } }
main.c: In function 'main': main.c:5:10: error: stray '\342' in program 5 | scanf(<U+201C>%d<U+201D>,&n); | ^~~~~~~~ main.c:5:11: error: expected expression before '%' token 5 | scanf(“%d”,&n); | ^ main.c:5:13: error: stray '\342' in program 5 | scanf(<U+201C>%d<U+201D>,&n); | ^~~~~~~~ main.c:9:14: error: stray '\342' in program 9 | scanf(<U+201C>%d<U+201D>,&a[i]); | ^~~~~~~~ main.c:9:15: error: expected expression before '%' token 9 | scanf(“%d”,&a[i]); | ^ main.c:9:17: error: stray '\342' in program 9 | scanf(<U+201C>%d<U+201D>,&a[i]); | ^~~~~~~~ main.c:30:15: error: stray '\342' in program 30 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:30:16: error: expected expression before '%' token 30 | printf(“%d\n”,ans); | ^ main.c:30:18: error: stray '\' in program 30 | printf(“%d\n”,ans); | ^ main.c:30:20: error: stray '\342' in program 30 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:43:15: error: stray '\342' in program 43 | printf(<U+201C>%ld\n<U+201D>,y); | ^~~~~~~~ main.c:43:16: error: expected expression before '%' token 43 | printf(“%ld\n”,y); | ^ main.c:43:19: error: stray '\' in program 43 | printf(“%ld\n”,y); | ^ main.c:43:21: error: stray '\342' in program 43 | printf(<U+201C>%ld\n<U+201D>,y); | ^~~~~~~~
s509982248
p03846
C
#include<stdio.h> #include<math.h> int main(){ long n; scanf(“%ld”,&n); long a[n]; int ans=1; for(long i=0;i<n;i++){ scanf(“%ld”,&a[i]); } long temp; for(long i=0;i<n;i++){//sort for(long j=i+1;j<n;j++){ if(a[i]>a[j]){ temp=a[j]; a[j]=a[i]; a[i]=temp; } } } for(long i=0;i<n;i+=2){ if(a[i]!=i+1-n%2){ ans=0; break; } } if(ans==0){ printf(“%d\n”,ans); }else{ long x=pow(10,9)+7; unsigned long y; if(n>pow(10,3)){ y=pow(2,(n-500-n%2)/2); y=y%x; x=(long)pow(2,250)%x; y=y*x; }else{ y=pow(2,(n-n%2)/2); y=y%x; } printf(“%ld\n”,y); } }
main.c: In function 'main': main.c:5:10: error: stray '\342' in program 5 | scanf(<U+201C>%ld<U+201D>,&n); | ^~~~~~~~ main.c:5:11: error: expected expression before '%' token 5 | scanf(“%ld”,&n); | ^ main.c:5:14: error: stray '\342' in program 5 | scanf(<U+201C>%ld<U+201D>,&n); | ^~~~~~~~ main.c:9:14: error: stray '\342' in program 9 | scanf(<U+201C>%ld<U+201D>,&a[i]); | ^~~~~~~~ main.c:9:15: error: expected expression before '%' token 9 | scanf(“%ld”,&a[i]); | ^ main.c:9:18: error: stray '\342' in program 9 | scanf(<U+201C>%ld<U+201D>,&a[i]); | ^~~~~~~~ main.c:30:15: error: stray '\342' in program 30 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:30:16: error: expected expression before '%' token 30 | printf(“%d\n”,ans); | ^ main.c:30:18: error: stray '\' in program 30 | printf(“%d\n”,ans); | ^ main.c:30:20: error: stray '\342' in program 30 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:43:15: error: stray '\342' in program 43 | printf(<U+201C>%ld\n<U+201D>,y); | ^~~~~~~~ main.c:43:16: error: expected expression before '%' token 43 | printf(“%ld\n”,y); | ^ main.c:43:19: error: stray '\' in program 43 | printf(“%ld\n”,y); | ^ main.c:43:21: error: stray '\342' in program 43 | printf(<U+201C>%ld\n<U+201D>,y); | ^~~~~~~~
s201163980
p03846
C
#include<stdio.h> #include<math.h> int main(){ long n; scanf(“%ld”,&n); long a[n]; int ans=1; for(long i=0;i<n;i++){ scanf(“%ld”,&a[i]); } long temp; for(long i=0;i<n;i++){//sort for(long j=i+1;j<n;j++){ if(a[i]>a[j]){ temp=a[j]; a[j]=a[i]; a[i]=temp; } } } for(long i=0;i<n;i+=2){ if(a[i]!=i+1-n%2){ ans=0; break; } } if(ans==0){ printf(“%d\n”,ans); }else{ long x=pow(10,9)+7; unsigned long y; if(n>pow(10,3)){ y=pow(2,(n-500-n%2)/2); y=y%x; x=(long)pow(2,250)%x; y=y*x; }else{ y=pow(2,(n-n%2)/2); y=y%x; } printf(“%ld\n”,y); } }
main.c: In function 'main': main.c:5:10: error: stray '\342' in program 5 | scanf(<U+201C>%ld<U+201D>,&n); | ^~~~~~~~ main.c:5:11: error: expected expression before '%' token 5 | scanf(“%ld”,&n); | ^ main.c:5:14: error: stray '\342' in program 5 | scanf(<U+201C>%ld<U+201D>,&n); | ^~~~~~~~ main.c:9:14: error: stray '\342' in program 9 | scanf(<U+201C>%ld<U+201D>,&a[i]); | ^~~~~~~~ main.c:9:15: error: expected expression before '%' token 9 | scanf(“%ld”,&a[i]); | ^ main.c:9:18: error: stray '\342' in program 9 | scanf(<U+201C>%ld<U+201D>,&a[i]); | ^~~~~~~~ main.c:30:15: error: stray '\342' in program 30 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:30:16: error: expected expression before '%' token 30 | printf(“%d\n”,ans); | ^ main.c:30:18: error: stray '\' in program 30 | printf(“%d\n”,ans); | ^ main.c:30:20: error: stray '\342' in program 30 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:43:15: error: stray '\342' in program 43 | printf(<U+201C>%ld\n<U+201D>,y); | ^~~~~~~~ main.c:43:16: error: expected expression before '%' token 43 | printf(“%ld\n”,y); | ^ main.c:43:19: error: stray '\' in program 43 | printf(“%ld\n”,y); | ^ main.c:43:21: error: stray '\342' in program 43 | printf(<U+201C>%ld\n<U+201D>,y); | ^~~~~~~~
s281747394
p03846
C
#include<stdio.h> #include<math.h> int main(){ long n; scanf(“%ld”,&n); long a[n]; int ans=1; for(long i=0;i<n;i++){ scanf(“%ld”,&a[i]); } int chek=0; for(long i=0;i<(n/2)+n%2;i++){ chek=0; if(n%2==1){ for(long j=0;j<n;j++){ if(i==0){ if(i==a[j])chek+=2; }else{ if(i*2==a[j])chek+=1; } } }else{ for(long j=0;j<n;j++){ if(i*2+1==a[j])chek+=1; } } if(chek!=2){ ans=0; break; } } if(ans==0){ printf(“%d\n”,ans); }else{ long x=pow(10,9)+7; unsigned long y=pow(2,(n-n%2)/2); y=y%x; printf(“%ld\n”,y); } }
main.c: In function 'main': main.c:5:9: error: stray '\342' in program 5 | scanf(<U+201C>%ld<U+201D>,&n); | ^~~~~~~~ main.c:5:10: error: expected expression before '%' token 5 | scanf(“%ld”,&n); | ^ main.c:5:13: error: stray '\342' in program 5 | scanf(<U+201C>%ld<U+201D>,&n); | ^~~~~~~~ main.c:9:13: error: stray '\342' in program 9 | scanf(<U+201C>%ld<U+201D>,&a[i]); | ^~~~~~~~ main.c:9:14: error: expected expression before '%' token 9 | scanf(“%ld”,&a[i]); | ^ main.c:9:17: error: stray '\342' in program 9 | scanf(<U+201C>%ld<U+201D>,&a[i]); | ^~~~~~~~ main.c:34:14: error: stray '\342' in program 34 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:34:15: error: expected expression before '%' token 34 | printf(“%d\n”,ans); | ^ main.c:34:17: error: stray '\' in program 34 | printf(“%d\n”,ans); | ^ main.c:34:19: error: stray '\342' in program 34 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:39:14: error: stray '\342' in program 39 | printf(<U+201C>%ld\n<U+201D>,y); | ^~~~~~~~ main.c:39:15: error: expected expression before '%' token 39 | printf(“%ld\n”,y); | ^ main.c:39:18: error: stray '\' in program 39 | printf(“%ld\n”,y); | ^ main.c:39:20: error: stray '\342' in program 39 | printf(<U+201C>%ld\n<U+201D>,y); | ^~~~~~~~
s574515531
p03846
C
#include<stdio.h> #include<math.h> int main(){ long n; scanf(“%ld”,&n); long a[n]; int ans=1; for(long i=0;i<n;i++){ scanf(“%ld”,&a[i]); } int chek=0; for(long i=0;i<(n/2)+n%2;i++){ chek=0; if(n%2==1){ for(long j=0;j<n;j++){ if(i==0){ if(i==a[j])chek+=2; }else{ if(i*2==a[j])chek+=1; } } }else{ for(long j=0;j<n;j++){ if(i*2+1==a[j])chek+=1; } } if(chek!=2){ ans=0; break; } } if(ans==0){ printf(“%d\n”,ans); }else{ long x=pow(10,9)+7; unsigned long y=pow(2,(n-n%2)/2); y=y%x; printf(“%ld\n”,y); } }
main.c: In function 'main': main.c:5:9: error: stray '\342' in program 5 | scanf(<U+201C>%ld<U+201D>,&n); | ^~~~~~~~ main.c:5:10: error: expected expression before '%' token 5 | scanf(“%ld”,&n); | ^ main.c:5:13: error: stray '\342' in program 5 | scanf(<U+201C>%ld<U+201D>,&n); | ^~~~~~~~ main.c:9:13: error: stray '\342' in program 9 | scanf(<U+201C>%ld<U+201D>,&a[i]); | ^~~~~~~~ main.c:9:14: error: expected expression before '%' token 9 | scanf(“%ld”,&a[i]); | ^ main.c:9:17: error: stray '\342' in program 9 | scanf(<U+201C>%ld<U+201D>,&a[i]); | ^~~~~~~~ main.c:34:14: error: stray '\342' in program 34 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:34:15: error: expected expression before '%' token 34 | printf(“%d\n”,ans); | ^ main.c:34:17: error: stray '\' in program 34 | printf(“%d\n”,ans); | ^ main.c:34:19: error: stray '\342' in program 34 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:39:14: error: stray '\342' in program 39 | printf(<U+201C>%ld\n<U+201D>,y); | ^~~~~~~~ main.c:39:15: error: expected expression before '%' token 39 | printf(“%ld\n”,y); | ^ main.c:39:18: error: stray '\' in program 39 | printf(“%ld\n”,y); | ^ main.c:39:20: error: stray '\342' in program 39 | printf(<U+201C>%ld\n<U+201D>,y); | ^~~~~~~~
s193645370
p03846
C++
#include <stdio.h> int main(void) { int n,a[100001]; scanf("%d",&n); for(i=0; i<n; i++)scanf("%d",&a[i]); puts("0"); return 0; }
a.cc: In function 'int main()': a.cc:6:13: error: 'i' was not declared in this scope 6 | for(i=0; i<n; i++)scanf("%d",&a[i]); | ^
s124088668
p03846
C++
#include <algorithm> #include <bitset> #include <cstdio> #include <functional> #include <initializer_list> #include <iostream> #include <limits.h> #include <list> #include <map> #include <math.h> #include <queue> #include <regex> #include <set> #include <sstream> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; #define ull unsigned long long #define ll long long #define rep(i, a, n) for (int i = (a); i < (int)(n); i++) #define repc(i, a, n) for (int i = (a); i <= (int)(n); i++) #define all(t) t.begin(), t.end() #define rall(t) t.rbegin(), t.rend() #define mat(type, row, col, init) \ vector<vector<type>>(row, vector<type>(col, init)); #define Yes(cond) cout << (cond ? "Yes" : "No") << endl; #define YES(cond) cout << (cond ? "YES" : "NO") << endl; #define DBG(str) cerr << (str) << endl; ll modpow(ll n, ll p, ll M) { ll ans = n; rep(i, 0, p - 1) { ans = (ans * n) % M; } return ans; } int main() { int n; cin >> n; vector<int> a(n); map<int, int> m; rep(i, 0, n) { cin >> a[i]; m[a[i]]++; } bool valid = true; if (i % 2 == = 0) { rep(i, 0, n / 2) { int k = 2 * i + 1; if (m[k] != 2) { valid = 0; break; } } } else { rep(i, 0, n / 2) { int k = 2 * i + 2; if (m[k] != 2) { valid = 0; break; } } if (m[0] != 1) valid = 0; } sort(all(a)); if (valid) { rep(i, 0, n) cin >> a[i]; ll M = 1e9 + 7; cout << modpow(2, n / 2, M) << endl; } else cout << 0 << endl; return 0; }
a.cc: In function 'int main()': a.cc:47:7: error: 'i' was not declared in this scope 47 | if (i % 2 == = 0) { | ^ a.cc:47:16: error: expected primary-expression before '=' token 47 | if (i % 2 == = 0) { | ^
s087262305
p03846
C
#include<stdio.h> int main(){ int n; scanf("%d",&n); int a[n/2+!],i,j; long ans=1,tmp=0; for(i=0;i<n/2+1;i++)a[i]=0; if(n%2==0)a[n/2]=2; for(i=0;i<n;i++){ scanf("%d",&tmp); a[tmp/2]++; } for(i=0;i<n/2+1;i++){ if(n%2==0){ if(a[i]!=2){ puts("0"); return 0; } } else{ if(i!=0&&a[i]!=2){ puts("0"); return 0; } } } for(i=0;i<n/2;i++)ans=(ans*2)%(1000000007); printf("%ld\n",ans); return 0; }
main.c: In function 'main': main.c:6:28: error: expected expression before ']' token 6 | int a[n/2+!],i,j; | ^
s499812378
p03846
C
#include<stdio.h> int main(){ int n; scanf("%d",&n); int a[n],i,j; long ans=1; for(i=0;i<n;i++)scanf("%d",&a[i]); for(i=0;i<n;i++){ for(j=0;j<n;j++){ if(a[i]<a[j]){ int tmp=a[i]; a[i]=a[j]; a[j]=tmp; } } } if(n%2==1){ int tmp=a[0]; if(a[0]!=0||a[0]==a[1]){ puts("0"); return 0; } } if(n%2==0){ int tmp=a[0]; if(a[0]!=1||a[0]!=a[1]){ puts("0"); return 0; } } for(i=2;i<n;i+=2){ if(tmp!=a[i]-2){ puts("0"); return 0; } tmp=a[i]; } for(i=0;i<n/2;i++)ans=(ans*2)%(1000000007); printf("%ld\n",ans); return 0; }
main.c: In function 'main': main.c:34:52: error: 'tmp' undeclared (first use in this function) 34 | if(tmp!=a[i]-2){ | ^~~ main.c:34:52: note: each undeclared identifier is reported only once for each function it appears in
s224472923
p03846
C
#include<stdio.h> int main(){ int n; scanf("%d",&n); int a[n],i,j; long ans=1; for(i=0;i<n;i++)scanf("%d",&a[i]); for(i=0;i<n;i++){ for(j=0;j<n;j++){ if(a[i]<a[j]){ int tmp=a[i]; a[i]=a[j]; a[j]=tmp; } } } if(n%2==1){ int tmp=a[0]; for(i=2;i<n;i+=2){ if(tmp!=tmp[i]-2){ puts("0"); return 0; } tmp=a[i]; } if(a[0]!=0||a[0]==a[1]){ puts("0"); return 0; } } if(n%2==0){ int tmp=a[0]; for(i=2;i<n;i+=2){ if(tmp!=tmp[i]-2){ puts("0"); return 0; } tmp=a[i]; } if(a[0]!=1||a[0]!=a[1]){ puts("0"); return 0; } } for(i=0;i<n/2;i++)ans=ans*2; printf("%ld\n",ans%(10*10*10*10*10*10*10*10*10+7)); return 0; }
main.c: In function 'main': main.c:22:60: error: subscripted value is neither array nor pointer nor vector 22 | if(tmp!=tmp[i]-2){ | ^ main.c:36:60: error: subscripted value is neither array nor pointer nor vector 36 | if(tmp!=tmp[i]-2){ | ^
s064644147
p03846
C++
#include <string.h> #include <iostream> #include <math.h> using namespace std; int main() { cout<<(int)pow(2, N / 2) % 1000000007<<endl; }
a.cc: In function 'int main()': a.cc:6:19: error: 'N' was not declared in this scope 6 | cout<<(int)pow(2, N / 2) % 1000000007<<endl; | ^
s803511500
p03846
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; int main(){ long long N; cin >> N; bool odd; if(N % 2) odd = true; else odd = false; vector<int> A(N), cnt(n); for(int i = 0; i < N; i++){ cin >> A[i]; cnt[A[i]]++; } bool exist_ans = true; if(odd){ for(int i = 0; i < N; i += 2){ if(i == 0 && cnt[i] != 1 ) exist_ans = false; else{ if(cnt[i] != 2) exist_ans = false; } } } else{ for(int i = 1; i < N; i += 2){ if(cnt[i] != 2) exist_ans = false; } } if(exist_ans) cout << static_cast<long long>(pow(2, N/2)) % static_cast<long long>((pow(10, 9) + 7)) << endl; else cout << 0 << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:27: error: 'n' was not declared in this scope 13 | vector<int> A(N), cnt(n); | ^
s310736873
p03846
C++
#include<bits/stdc++.h> using namespace std; int n,a[500000],t[500000],tag,an; int main(){ cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; t[a[i]]++; } for(int i=1;i<n+5;i++){ if(t[i]%2==1)tag=1; } if(tag==0){ for(int i=1;i<n+5;i++){ if(t[i]>0)an++; } cout<<pow(2,an)%1000000007<<endl; }else{ cout<<0<<endl; } }
a.cc: In function 'int main()': a.cc:19:24: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 19 | cout<<pow(2,an)%1000000007<<endl; | ~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s559609568
p03846
C++
#include<bits/stdc++.h> using namespace std; int n, a[100005]; bool flag; int main() { cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } sort(a, a + n); if(n % 2){ if(a[0] == 0){ ans = 1; } } else{ if(a[0] == a[1]){ ans = 2; } } int j = 1; for(int i = (n % 2 ? 2 : 3); i < n; i += 2){ if(a[i] == a[i - 1] && i == j){ ans *= 2; j++; } else flag = true; } if(flag)cout << 0 << endl; else cout << ans << endl; }
a.cc: In function 'int main()': a.cc:14:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | ans = 1; | ^~~ | abs a.cc:19:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 19 | ans = 2; | ^~~ | abs a.cc:25:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 25 | ans *= 2; | ^~~ | abs a.cc:31:16: error: 'ans' was not declared in this scope; did you mean 'abs'? 31 | else cout << ans << endl; | ^~~ | abs
s032185146
p03846
C++
#include <iostream> #include <algorithm> #include <set> #include <map> #include <string> using namespace std; typedef long long ll; #define rep(i,s,n)for(ll i = s;i<n;i++) #define repe(i,s,n)for(ll i = s;i<=n;i++) ll a[100001] = {}; ll b[100001] = {}; int main() { ll N; cin >> N; repe(i, 1, N) { cin >> a[i]; b[a[i]]++; } if (N % 2 == 1) { repe(i, 1, N) { if (i == 0 && b[i] != 1) { cout << 0 << endl; return 0; } else if (i % 2 == 0 && b[i] != 2) { cout << 0 << endl; return 0; } else if (i % 2 == 1 && b[i] != 0) { cout << 0 << endl; return 0; } } } else { repe(i, 1, N) { if (i % 2 == 1 && b[i] != 2) { cout << 0 << endl; return 0; } else if (i % 2 == 0 && b[i] != 0) { cout << 0 << endl; return 0; } } } cout << pow(2, N / 2); return 0; }
a.cc: In function 'int main()': a.cc:51:17: error: 'pow' was not declared in this scope 51 | cout << pow(2, N / 2); | ^~~
s626631198
p03846
C++
#include<iostream> #include<math.h> using namespace std; int main(){ int n;cin>>n; int a[n]; int b[n]; for(int i=0;i<n;i++)b[i]=0; for(int i=0;i<n;i++)cin>>a[i]; for(int i=0;i<n;i++)b[a[i]]++; if(n%2==0){ for(int i=1;i<n;i+=2){ if(b[i]!=2){ cout<<0<<endl; return 0; } } }else{ b[0]++; for(int i=0;i<n;i+=2){ if(b[i]!=2){ cout<<0<<endl; return 0; } } } cout<<pow(2,n/2)%1000000007<<endl; return 0; }
a.cc: In function 'int main()': a.cc:28:19: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 28 | cout<<pow(2,n/2)%1000000007<<endl; | ~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s113562097
p03846
C++
#include<iostream> using namespace std; int main(){ int n; cin>>n; int a[n]; int box[n]={0}; for(int i=0;i<n;i++){ cin>>a[i]; box[a[i]]++; } int m=0; long long int x=1 int mod=1000000007; if(n%2==0){ for(int i=0;i<n;i++){ if(box[i]==1||box[i]>2){ cout<<0<<endl; return 0; } } for(int i=0;i<n/2;i++){ x*=2; } x%=mod; cout<<x<<endl; } else{ if(box[0]!=1){ cout<<0<<endl; return 0; } for(int i=0;i<n;i++){ if(box[i]!=0&&box[i]!=2){ cout<<0<<endl; return 0; } } for(int i=0;i<n/2;i++){ x*=2; } x%=mod; cout<<x<<endl; } }
a.cc: In function 'int main()': a.cc:15:9: error: expected ',' or ';' before 'int' 15 | int mod=1000000007; | ^~~ a.cc:26:20: error: 'mod' was not declared in this scope 26 | x%=mod; | ^~~ a.cc:43:20: error: 'mod' was not declared in this scope 43 | x%=mod; | ^~~
s871366608
p03846
C++
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { int n, a[100000], i, cnt = 0, sum = 1, j, k = 0,x; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &a[i]); } for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (a[i] == a[j]&&i!=j) { cnt += 1; } } if (cnt != 1 && a[i] != 0 || cnt != 0 && a[i] == 0) { printf("0"); k = 1; break; } cnt = 0; } if (k == 0) { x=n/2; while(x!=0){ if (sum >= 1000000007) { sum -= 1000000007; } if(x%2=0){ sum*=4; x/2; } else{ sum*=2; x-1; } } printf("%d", sum); } }
a.cc: In function 'int main()': a.cc:28:27: error: lvalue required as left operand of assignment 28 | if(x%2=0){ | ~^~
s102165579
p03846
C++
int main() { int n, a[100000], i, cnt = 0, sum = 1, j, k = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &a[i]); } for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (a[i] == a[j]&&i!=j) { cnt += 1; } } if (cnt != 1 && a[i] != 0 || cnt != 0 && a[i] == 0) { printf("0"); k = 1; break; } cnt = 0; } if (k == 0) { for (i = 0; i < n / 2; i++) { if (sum >= 1000000007) { sum -= 1000000007; } sum *= 2; } printf("%d", sum); } }
a.cc: In function 'int main()': a.cc:3:9: error: 'scanf' was not declared in this scope 3 | scanf("%d", &n); | ^~~~~ a.cc:14:25: error: 'printf' was not declared in this scope 14 | printf("0"); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int main() { a.cc:27:17: error: 'printf' was not declared in this scope 27 | printf("%d", sum); | ^~~~~~ a.cc:27:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s932700829
p03846
C++
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { int n, a[100000], i, cnt = 0, max = 0, sum = 1,j; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &a[i]); if (a[i] == 0) { cnt = 1; } if (a[i] >= max) { max = a[i]; } } for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (a[i] == a[j]) { cnt++; } } if (cnt != 2 && a[i] != 0 || cnt != 1 && a[i] == 0) { printf("0"); return 0; } } for (i = 0; i < n / 2; i++) { if (sum >= 1000000007) { sum -= 1000000007; } sum *= 2; } printf("%d", sum);
a.cc: In function 'int main()': a.cc:32:27: error: expected '}' at end of input 32 | printf("%d", sum); | ^ a.cc:3:12: note: to match this '{' 3 | int main() { | ^
s741037248
p03846
C++
#include <iostream> #include <algorithm> #include <functional> #include<vector> #include<math.h> #include<bitset> #include<string> #include <deque> #include<queue> #include<map> using namespace std; int X[10000]; int mod = 1e9 + 7; int main() { int N; long long int Y = 0; int Z = 0; int a; cin >> N; for (int i = 0; i < N; i++) { cin >> a; X[a]++; if (X[a] == 3) { Z = 5; } } for (int i = 0; i < 10000; i++) { if (X[i] == 1) { if (N%2==1&&i==0) { Z++; } else { Z = 5; } } else if (X[i] == 2) { Y++; } } if (N % 2 == 0) { if (Z > 0)cout << 0 << endl; else { long long int R = 1; for (int i = 0; i < N / 2; i++) { R = R % mod * 2; } cout << R << endl; } } else { if (Z == 1) { long long int R = 1; for (int i = 0; i < N / 2; i++) { R = R % mod * 2; } cout << R << endl; } else { cout << 0 << endl; } } return 0; } #include <iostream> #include <algorithm> #include <functional> #include<vector> #include<math.h> #include<bitset> #include<string> #include <deque> #include<queue> #include<map> using namespace std; int X[10000]; int mod = 1e9 + 7; int main() { int N; long long int Y = 0; int Z = 0; int a; cin >> N; for (int i = 0; i < N; i++) { cin >> a; X[a]++; if (X[a] == 3) { Z = 5; } } for (int i = 0; i < 10000; i++) { if (X[i] == 1) { if (N%2==1&&i==0) { Z++; } else { Z = 5; } } else if (X[i] == 2) { Y++; } } if (N % 2 == 0) { if (Z > 0)cout << 0 << endl; else { long long int R = 1; for (int i = 0; i < N / 2; i++) { R = R % mod * 2; } cout << R << endl; } } else { if (Z == 1) { long long int R = 1; for (int i = 0; i < N / 2; i++) { R = R % mod * 2; } cout << R << endl; } else { cout << 0 << endl; } } return 0; }
a.cc:88:5: error: redefinition of 'int X [10000]' 88 | int X[10000]; | ^ a.cc:13:5: note: 'int X [10000]' previously declared here 13 | int X[10000]; | ^ a.cc:89:5: error: redefinition of 'int mod' 89 | int mod = 1e9 + 7; | ^~~ a.cc:14:5: note: 'int mod' previously defined here 14 | int mod = 1e9 + 7; | ^~~ a.cc:91:5: error: redefinition of 'int main()' 91 | int main() { | ^~~~ a.cc:16:5: note: 'int main()' previously defined here 16 | int main() { | ^~~~
s793060804
p03846
C++
#include <iostream> #include <algorithm> #include <functional> #include<vector> #include<math.h> #include<bitset> #include<string> #include <deque> #include<queue> #include<map> using namespace std; int X[10000]; int main() { int N; long long int Y = 0; int Z = 0; int a; cin >> N; for (int i = 0; i < N; i++) { cin >> a; X[a]++; if (X[a] == 3) { Z = 5; } } for (int i = 0; i < 10000; i++) { if (X[i] == 1) { if (N%2==1&&i==0) { Z++; } else { Z = 5; } } else if (X[i] == 2) { Y++; } } long long int R = 1; for (int i = 0; i < Y; i++) { R *= 2; R %= 1000000007; } if (N % 2 == 0) { if (Z > 0)cout << 0 << endl; else cout << R<< endl; } else { if (Z == 1) { cout << R << endl; } else { cout << 0 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:63:10: error: expected '}' at end of input 63 | } | ^ a.cc:15:12: note: to match this '{' 15 | int main() { | ^
s527464859
p03846
C++
#include <iostream> #include <algorithm> #include <functional> #include<vector> #include<math.h> #include<bitset> #include<string> #include <deque> #include<queue> #include<map> using namespace std; int X[10000]; int main() { int N; long long int Y = 0; int Z = 0; int a; cin >> N; for (int i = 0; i < N; i++) { cin >> a; X[a]++; if (X[a] == 3) { Z = 5; } } for (int i = 0; i < 10000; i++) { if (X[i] == 1) { if (N%2==1&&i==0) { Z++; } else { Z = 5; } } else if (X[i] == 2) { Y++; } } long long int R = pow(2, Y); if (N % 2 == 0) { if (Z > 0)cout << 0 << endl; else cout << R%1000000007 << endl; } else { if (Z == 1) { cout << R%1000000007 << endl; } else { cout << 0 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:59:10: error: expected '}' at end of input 59 | } | ^ a.cc:15:12: note: to match this '{' 15 | int main() { | ^
s258555034
p03846
C++
#include<iostream> #include<math.h> #include<algorithm> using namespace std; int N, temp; bool c = true long long ans = 1; int line[100100]; void checkList(){ if(N % 2 == 1){ /*if(line[0] != 0){ return 0; } for(int i = 0; i < N; i++){ temp = i; if(i % 2 == 1){ temp++; } if(line[i] != temp){ return 0; } }*/ for(int i = 0; i < N; i++){ if(line[i] != (i+1)/2*2){ c = false; } } }else{ /*for(int i = 0; i < N; i++){ temp = i; if(i % 2 ==0){ temp++; } if(line[i] != temp){ return 0; } }*/ for(int i = 0; i < N; i++){ if(line[i] != i/2*2+1){ c = false; } } } /*for(int i = 0; i < N / 2; i++){ ans *= 2; }*/ } int main(){ cin >>N; for(int i = 0; i < N; i++){ cin >>line[i]; } sort(line, line + N); checkList(); //for(int i = 0; i < N; i++) { // if(i)cout << " "; // cout << line[i]; //} for(int i = 0; i < N / 2; i++){ ans *= 2; } cout << ans << endl; }
a.cc:9:1: error: expected ',' or ';' before 'long' 9 | long long ans = 1; | ^~~~ a.cc: In function 'int main()': a.cc:67:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 67 | ans *= 2; | ^~~ | abs a.cc:69:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 69 | cout << ans << endl; | ^~~ | abs
s142108900
p03846
C++
#include<iostream> #include<math.h> #include<algorithm> using namespace std; int N, temp; int ans = 1; int line[100100]; int checkList(){ if(N % 2 == 1){ if(line[0] != 0){ return 0; } for(int i = 0; i < N; i++){ temp = i; if(i % 2 == 1){ temp++; } if(line[i] != temp){ return 0; } } for(int i = 0; i < (N - 1) / 2; i++){ ans *= 2; } return ans % ; }else{ for(int i = 0; i < N; i++){ temp = i; if(i % 2 ==0){ temp++; } if(line[i] != temp){ return 0; } } for(int i = 0; i < N / 2; i++){ ans *= 2; } return ans % 1000000007; } } int main(){ cin >>N; for(int i = 0; i < N; i++){ cin >>line[i]; } sort(line, line + N); ans = checkList(); //for(int i = 0; i < N; i++) { // if(i)cout << " "; // cout << line[i]; //} cout << ans << endl; }
a.cc: In function 'int checkList()': a.cc:29:22: error: expected primary-expression before ';' token 29 | return ans % ; | ^
s032509204
p03846
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,a[100005]; cin>>n; for(int i=0;i<n;i++) cin>>a[i]; sort(a,a+n); bool check = true; if(n%2!=0){ int m=2; if(a[0]!=0)check=false; for(int i=1;i<n;){ if(a[i]!=m||a[i+1]!=m)check=false; m += 2; i += 2; } } if(n%2==0){ int m=1; for(int i=0;i<n/2;){ if(a[i]!=m||a[i+1]!=m) m += 2; i += 2; } } long long int ex = 1000000007; if(check==1){cout<<pow(2,n/2)%ex<<endl;} else if(check==0)cout<<0<<endl; }
a.cc: In function 'int main()': a.cc:30:38: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%' 30 | if(check==1){cout<<pow(2,n/2)%ex<<endl;} | ~~~~~~~~~~^~~ | | | | | long long int | __gnu_cxx::__promote<double>::__type {aka double}
s463888013
p03846
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; int array[n]; for(int i = 0; i<n; i++){ cin >> array[i]; } sort(array, array+n); bool flag = true; int ans = 1; if(n%2==0){ for(int i=0; i<n; i++){ if(array[i] != i/2 * 2 + 1){ flag = false; break; } if( (i+1)%2==0){ ans = ans * 2 % 1000000007; } } }else{ for(int i = 0; i<n; i++){ if(array[i] != (1+i)/2 * 2){ flag = false; break; } if( (i+1)%2==0){ ans = ans * 2 % 1000000007; } } } if(!flag)ans = 0; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(array, array+n); | ^~~~ | short
s413971973
p03846
C++
#include<iostream> #include<math.h> #include<algorithm> using namespace std; long long judge(int N, int line[]){ int temp; if(N % 2 == 0){ for(int i = 0; i < N; i++){ temp = i; if(i % 2 == 0){ temp++; } if(line[i] != temp){ return 0; } } return (long long)powl(2, N/2) % (long long)1ep + 7; //return pow(2, N/2); }else{ if(line[0] != 0){ return 0; } for(int i = 1; i < N; i++){ temp = i; if(i % 2 == 1){ temp++; } if(line[i] != temp){ return 0; } } return (long long)powl(2, (N - 1) / 2) % (long long)1e9 + 7; //return pow(2, (N - 1) / 2); } } int main(){ int N; long long ans; cin >>N; int line[N]; for(int i = 0; i < N; i++){ cin >>line[i]; } sort(line, line + N); ans = judge(N, line); cout << ans << endl; //cout << ans / (pow(10, 9) +7) << endl; }
a.cc:21:53: error: exponent has no digits 21 | return (long long)powl(2, N/2) % (long long)1ep + 7; | ^~~
s059587764
p03846
C++
#include <cstdio> #include <iostream> using namespace std; #define mod 1000000007 int x[100010]; int main(){ int n; cin >> n; for (int i = 0; i < n; i++) { int k; cin >> k; x[k]++; } if (n % 2 == 1) { bool flag = true; long long ans = 1; if (x[0] != 1) flag = false; for (int i = 2; i < n; i += 2) { if (x[i] != 2) flag = false; ans *= 2; ans %= mod; } if (!flag) cout << 0 << endl; else cout << ans << endl; } else { bool flag = true; long long ans = 1; for (int i = 1; i < n; i += 2) { if (x[i] != 2) flag = false; ans *= 2; ans %= mod; } if (!flag) cout << 0 << endl; else cout << ans << endl; } return 0; } #include <cstdio> #include <iostream> using namespace std; #define mod 1000000007 int x[100010]; int main(){ int n; cin >> n; for (int i = 0; i < n; i++) { int k; cin >> k; x[k]++; } if (n % 2 == 1) { bool flag = true; long long ans = 1; if (x[0] != 1) flag = false; for (int i = 2; i < n; i += 2) { if (x[i] != 2) flag = false; ans *= 2; ans %= mod; } if (!flag) cout << 0 << endl; else cout << ans << endl; } else { bool flag = true; long long ans = 1; for (int i = 1; i < n; i += 2) { if (x[i] != 2) flag = false; ans *= 2; ans %= mod; } if (!flag) cout << 0 << endl; else cout << ans << endl; } return 0; }
a.cc:42:5: error: redefinition of 'int x [100010]' 42 | int x[100010]; | ^ a.cc:5:5: note: 'int x [100010]' previously declared here 5 | int x[100010]; | ^ a.cc:44:5: error: redefinition of 'int main()' 44 | int main(){ | ^~~~ a.cc:7:5: note: 'int main()' previously defined here 7 | int main(){ | ^~~~
s034754808
p03846
C++
#include <iostream> using namespace std; #define mod 1000000007 int x[100010]; int main(){ int n; cin >> n; for (int i = 0; i < n; i++) { int k; cin >> k; x[k]++; } if (n % 2 == 1) { bool flag = true; long long ans = 1; if (x[0] != 1) flag = false; for (int i = 2; i < n; i += 2) { if (x[i] != 2) flag = false; ans *= 2; ans %= mod; } if (!flag) cout << 0 << endl; else cout << ans << endl; } else { bool flag = true; long long ans = 1; for (int i = 1; i < n; i += 2) { if (x[i] != 2) flag = false; ans *= 2; ans %= mod; } if (!flag) cout << 0 << endl; else cout << ans << endl; } return 0; } #include <cstdio> #include <iostream> using namespace std; #define mod 1000000007 int x[100010]; int main(){ int n; cin >> n; for (int i = 0; i < n; i++) { int k; cin >> k; x[k]++; } if (n % 2 == 1) { bool flag = true; long long ans = 1; if (x[0] != 1) flag = false; for (int i = 2; i < n; i += 2) { if (x[i] != 2) flag = false; ans *= 2; ans %= mod; } if (!flag) cout << 0 << endl; else cout << ans << endl; } else { bool flag = true; long long ans = 1; for (int i = 1; i < n; i += 2) { if (x[i] != 2) flag = false; ans *= 2; ans %= mod; } if (!flag) cout << 0 << endl; else cout << ans << endl; } return 0; }
a.cc:41:5: error: redefinition of 'int x [100010]' 41 | int x[100010]; | ^ a.cc:4:5: note: 'int x [100010]' previously declared here 4 | int x[100010]; | ^ a.cc:43:5: error: redefinition of 'int main()' 43 | int main(){ | ^~~~ a.cc:6:5: note: 'int main()' previously defined here 6 | int main(){ | ^~~~
s363842988
p03846
C++
#include<iostream> #include<string> #include<cmath> using namespace std; typedef long long ll; int main(){ int n; int A[100100]; const int MOD = 1e9+7; cin >> n; for(int i = 0; i < n; i++) {int p; cin >> p; A[p]++;} long long ans = 1; flag = 1; if(n % 2 == 1){ if(A[0] != 1) {flag = 0;} for(int i = 2; i < n; i+=2){ if(A[i] != 2) {flag = 0;} ans*=2; ans %= MOD; } } else{ for(int i = 1; i < n; i+=2){ if(A[i] != 2) {flag = 0;} ans*=2; ans %= MOD; } } if(flag == 0) cout << 0 << endl; else cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:1: error: 'flag' was not declared in this scope 19 | flag = 1; | ^~~~
s431321416
p03846
C++
#include<iostream> #include<string> #include <cmath> using namespace std; typedef long long ll; int main(){ ll ans = 1; int a[100100]; const int MOD = 1e9+7; int n; cin >> n; for(int i = 0; i < n; i++) {int p; cin >> p; a[p]++;} if(n % 2 == 1) { if(a[0] != 1) ans = 0; else for(int i = 2; i < n; i+=2) if(a[i] == 2) (ans *= 2) %= MOD; else {cout << 0 << endl return 0;} } else{ for(int i = 1; i < n; i += 2) if(a[i] == 2) (ans *= 2) %= MOD; else {cout << 0 << endl return 0;} } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:24: error: expected ';' before 'return' 22 | else {cout << 0 << endl return 0;} | ^~~~~~~ | ; a.cc:28:25: error: expected ';' before 'return' 28 | else {cout << 0 << endl return 0;} | ^~~~~~~ | ;
s403248859
p03846
C++
#include<iostream> #include<string> #include <cmath> using namespace std; int main(){ ll n,p,i,ans = 1; int a[100000]; const int MOD = 1e9+7; cin >> n; for(i = 0; i < n; i++) {cin >> p; a[p]++;} if(n % 2 == 1) { if(a[0] != 1) ans = 0; else for(i = 2; i < n; i+=2){ if(a[i] == 2) (ans *= 2) %= MOD; else {ans = 0; break;} } } else{ for(i = 1; i < n; i += 2) if(a[i] == 2) (ans *= 2) %= MOD; else {ans = 0; break;} } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:1: error: 'll' was not declared in this scope 8 | ll n,p,i,ans = 1; | ^~ a.cc:13:8: error: 'n' was not declared in this scope 13 | cin >> n; | ^ a.cc:15:5: error: 'i' was not declared in this scope 15 | for(i = 0; i < n; i++) {cin >> p; a[p]++;} | ^ a.cc:15:32: error: 'p' was not declared in this scope 15 | for(i = 0; i < n; i++) {cin >> p; a[p]++;} | ^ a.cc:18:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 18 | if(a[0] != 1) ans = 0; | ^~~ | abs a.cc:19:10: error: 'i' was not declared in this scope 19 | else for(i = 2; i < n; i+=2){ | ^ a.cc:20:16: error: 'ans' was not declared in this scope; did you mean 'abs'? 20 | if(a[i] == 2) (ans *= 2) %= MOD; | ^~~ | abs a.cc:21:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 21 | else {ans = 0; break;} | ^~~ | abs a.cc:26:5: error: 'i' was not declared in this scope 26 | for(i = 1; i < n; i += 2) | ^ a.cc:27:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 27 | if(a[i] == 2) (ans *= 2) %= MOD; | ^~~ | abs a.cc:28:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 28 | else {ans = 0; break;} | ^~~ | abs a.cc:31:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 31 | cout << ans << endl; | ^~~ | abs
s108981460
p03846
C++
#include<iostream> #include<string> #include <cmath> #define MOD 1000000007 using namespace std; int main(){ int n,p,i,ans = 1; int a[100000]; cin >> n; for(i = 0; i < n; i++) {cin >> p; a[p]++;} if(n % 2 == 1) { if(a[0] != 1) ans = 0; else for(i = 2; i < n; i+=2){ {if(a[i] != 2) ans = 0; break;} } } else for(i = 1; i < n; i += 2) if(a[i] != 2) {ans = 0; break;} if(ans == 0) cout << 0 << endl; else {ans = pow(2,n/2); cout << ans % MOD <<endl; return 0; }
a.cc: In function 'int main()': a.cc:34:2: error: expected '}' at end of input 34 | } | ^ a.cc:7:11: note: to match this '{' 7 | int main(){ | ^
s352657943
p03846
C++
#include<iostream> #include<string> #include <cmath> #define INF 1000000007 using namespace std; int main(){ int n,p,i,ans = 1; int a[100000]; cin >> n; for(i = 0; i < n; i++) {cin >> p; a[p]++;} if(n % 2 == 1) { if(a[0] != 1) ans = 0; else for(i = 2; i < n; i+=2){ {if(a[i] != 2) ans = 0; break;} } } else for(i = 1; i < n; i += 2) if(a[i] != 2) {ans = 0; break;} if(ans == 0) cout << 0 << endl; else cout << pow(2,n/2) % INF <<endl; return 0; }
a.cc: In function 'int main()': a.cc:29:25: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 29 | else cout << pow(2,n/2) % INF <<endl; | ~~~~~~~~~~ ^ | | | __gnu_cxx::__promote<double>::__type {aka double}
s290450053
p03846
C++
#include <bits/stdc++.h> using namespace std; int a[100005]; int main(){ int n; cin >> n; int ma = 0; for(int i=0; i < n; i++){ int temp; cin >> temp; ma = max(ma, temp); a[temp] += 1; } int flag = 0; int Flag = 0; while(ma > 0){ if(a[ma] == 2) flag = 1; if(flag == 0) Flag = 1; flag = 0; ma -= 2; } long long res = (pow(2, n / 4) % 1000000007) * (pow(2, n / 4) % 1000000007) % 1000000007; if(Flag) cout << 0 << endl; else if(n % 2 == 1 and a[0] == 1) cout << res << endl; else if(n % 2 == 0 and a[0] == 0) cout << res << endl; else cout << 0 << endl; return 0; }
a.cc: In function 'int main()': a.cc:28:36: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 28 | long long res = (pow(2, n / 4) % 1000000007) * (pow(2, n / 4) % 1000000007) % 1000000007; | ~~~~~~~~~~~~~ ^ ~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double} a.cc:28:67: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 28 | long long res = (pow(2, n / 4) % 1000000007) * (pow(2, n / 4) % 1000000007) % 1000000007; | ~~~~~~~~~~~~~ ^ ~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s272781637
p03846
C++
#include <bits/stdc++.h> using namespace std; int a[100005]; int main(){ int n; cin >> n; int ma = 0; for(int i=0; i < n; i++){ int temp; cin >> temp; ma = max(ma, temp); a[temp] += 1; } int flag = 0; while(ma > 0){ if(a[ma] == 2) flag = 1; if(flag == 0) goto cant; flag = 0; ma -= 2; } if(n % 2 == 1 and a[0] == 1) cout << pow(2, n/2) % (1000000007) << endl; else if(n % 2 == 0 and a[0] == 0) cout << pow(2, n/2) % (1000000007) << endl; else cout << 0 << endl; return 0; cant: cout << 0 << endl; }
a.cc: In function 'int main()': a.cc:27:54: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 27 | if(n % 2 == 1 and a[0] == 1) cout << pow(2, n/2) % (1000000007) << endl; | ~~~~~~~~~~~ ^ ~~~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double} a.cc:28:59: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 28 | else if(n % 2 == 0 and a[0] == 0) cout << pow(2, n/2) % (1000000007) << endl; | ~~~~~~~~~~~ ^ ~~~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double}
s975680186
p03846
C++
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[100010], count[100010] = {0}; for (int i = 0; i < n; i++) { cin >> a[i]; count[a[i]]++; } if (n%2 == 1) { count[0]++; } for (int i = (n+1)%2; i < n; i += 2) { if (conut[i] != 2) { cout << 0 << endl; return 0; } } long long ans = 1; for (int i = 0; i < n/2; i++) { ans *= 2; ans %= 1000000007; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:13: error: 'conut' was not declared in this scope; did you mean 'count'? 22 | if (conut[i] != 2) { | ^~~~~ | count
s269508184
p03846
C++
#include <iostream> #include <vector> #include <math.h> #include <iomanip> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector<int> ls(n); for (int i = 0; i < n; i++) { cin >> ls[i]; } std::sort(ls.begin(), ls.end()); if (n % 2 == 0) { int count = 1; for (int i = 0; i < n; i++) { if(ls[i] != count) { cout << 0; return 0; } if (i % 2 != 0) { count += 2; } } cout << stoull(fmod(pow(2, n / 2), 1000000007)); return 0; } else { if (ls[0] != 0) { cout << 0; return 0; } int count = 2; for (int i = 1; i < n; i++) { if(ls[i] != count) { cout << 0; return 0; } if (i % 2 == 0) { count += 2; } } cout << stoull(fmod(powl(2, (n - 1) / 2), 1000000007)); } return 0; }
a.cc: In function 'int main()': a.cc:31:23: error: no matching function for call to 'stoull(__gnu_cxx::__promote<double>::__type)' 31 | cout << stoull(fmod(pow(2, n / 2), 1000000007)); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:4185:3: note: candidate: 'long long unsigned int std::__cxx11::stoull(const std::string&, std::size_t*, int)' 4185 | stoull(const string& __str, size_t* __idx = 0, int __base = 10) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:4185:24: note: no known conversion for argument 1 from '__gnu_cxx::__promote<double>::__type' {aka 'double'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} 4185 | stoull(const string& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:4452:3: note: candidate: 'long long unsigned int std::__cxx11::stoull(const std::wstring&, std::size_t*, int)' 4452 | stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:4452:25: note: no known conversion for argument 1 from '__gnu_cxx::__promote<double>::__type' {aka 'double'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} 4452 | stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~~^~~~~ a.cc:49:23: error: no matching function for call to 'stoull(__gnu_cxx::__promote<long double>::__type)' 49 | cout << stoull(fmod(powl(2, (n - 1) / 2), 1000000007)); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4185:3: note: candidate: 'long long unsigned int std::__cxx11::stoull(const std::string&, std::size_t*, int)' 4185 | stoull(const string& __str, size_t* __idx = 0, int __base = 10) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:4185:24: note: no known conversion for argument 1 from '__gnu_cxx::__promote<long double>::__type' {aka 'long double'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'} 4185 | stoull(const string& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:4452:3: note: candidate: 'long long unsigned int std::__cxx11::stoull(const std::wstring&, std::size_t*, int)' 4452 | stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:4452:25: note: no known conversion for argument 1 from '__gnu_cxx::__promote<long double>::__type' {aka 'long double'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} 4452 | stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) | ~~~~~~~~~~~~~~~^~~~~
s637281969
p03846
C++
#include <iostream> #include <vector> #include <math.h> using namespace std; int main() { int n; cin >> n; vector<int> ls(n); for (int i = 0; i < n; i++) { cin >> ls[i]; } sort(ls.begin(), ls.end()); if (n % 2 == 0) { int count = 1; for (int i = 0; i < n; i++) { if(ls[i] != count) { cout << 0; return 0; } if (i % 2 != 0) { count += 2; } } cout << fmod(pow(2, n / 2), 1000000000 + 7); return 0; } else { if (ls[0] != 0) { cout << 0; return 0; } int count = 2; for (int i = 1; i < n; i++) { if(ls[i] != count) { cout << 0; return 0; } if (i % 2 == 0) { count += 2; } } cout << fmod(pow(2, (n - 1) / 2), 1000000000 + 7); } return 0; }
a.cc: In function 'int main()': a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 15 | sort(ls.begin(), ls.end()); | ^~~~ | sqrt
s436239534
p03846
C++
#include <iostream> #include <array> #include <math.h> using namespace std; int main() { int n; cin >> n; int ls[n]; for (int i = 0; i < n; i++) { cin >> ls[i]; } sort(ls, ls + n); if (n % 2 == 0) { int count = 1; for (int i = 0; i < n; i++) { if(ls[i] != count) { cout << 0; return 0; } if (i % 2 != 0) { count += 2; } } cout << fmod(pow(2, n / 2), 1000000000 + 7); return 0; } else { if (ls[0] != 0) { cout << 0; return 0; } int count = 2; for (int i = 1; i < n; i++) { if(ls[i] != count) { cout << 0; return 0; } if (i % 2 == 0) { count += 2; } } cout << fmod(pow(2, (n - 1) / 2), 1000000000 + 7); } return 0; }
a.cc: In function 'int main()': a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 15 | sort(ls, ls + n); | ^~~~ | sqrt
s224148663
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 sum = 0, ans = 1; for(int i = 0; i < n; i++) { sum += sc.nextInt(); } int key = 0; for(int i = n; i > 1; i -= 2) { key += n - 1; } key *= 2; if(sum == key) { for(int i = 0; i < n / 2; i++) ans *= 2; } else ans = 0; ans = ans % (1000000000 + 7) System.out.println(ans); } }
Main.java:20: error: ';' expected ans = ans % (1000000000 + 7) ^ 1 error
s418145829
p03846
C++
using namespace std; #include <iostream> #include <cstdlib> #include <algorithm> #include <cmath> #include <limits> #include <climits> #include <vector> #include <string> #include <set> #include <queue> #include <stack> #include <map> typedef long long ll; typedef pair<int,int> p; #define rep(i, n) for(int (i) = 0; (i) < (n); (i)++) int main() { // input & declare int n; cin >> n; std::vector<int> v; int tmp; for(int i = 0; i < n; i++) { cin >> tmp; v.push_back(tmp); } sort(v.begin(),v.end()); // process ll result = 0; for(int i = 1; i < n; i += 2){ // std::cout << i << '\n'; if (n % 2 == 0) { if (v[i-1] == v[i] && v[i] == i) { result = ((result + 1) % (pow(10,9) + 7)); }else{ std::cout << "0" << '\n'; exit(0); } } else if(n % 2 == 1){ if (i == 1){ v.erase(v.begin()); } if (v[i-1] == v[i] && v[i] == i+1) { result = ((result + 1) % (pow(10,9) + 7)); }else{ std::cout << "0" << '\n'; exit(0); } } } // output std::cout << pow(2,result) << '\n'; }
a.cc: In function 'int main()': a.cc:44:32: error: invalid operands of types 'll' {aka 'long long int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 44 | result = ((result + 1) % (pow(10,9) + 7)); | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~ | | | | | __gnu_cxx::__promote<double>::__type {aka double} | ll {aka long long int} a.cc:55:32: error: invalid operands of types 'll' {aka 'long long int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 55 | result = ((result + 1) % (pow(10,9) + 7)); | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~ | | | | | __gnu_cxx::__promote<double>::__type {aka double} | ll {aka long long int}
s012445361
p03846
C++
#include <iostream> #include <algorithm> #include <unordered_map> using namespace std; int main() { int N; cin >> N; long a[N]; unordered_map<long, long> aMap; for (int i = 0; i < N; ++i) { cin >> a[i]; if (aMap.find(a[i]) == aMap.end()) { aMap[a[i]] = 1; } else { ++aMap[a[i]]; } } if (N % 2 == 1) { if (aMap[0] != 1) { cout << "0" << endl; return 0; } for (int i = 1; i < N; ++i) { if (i % 2 == 0) { if (aMap[i] != 2) { cout << "0" << endl; return 0; } } else { if (aMap[i] != 0) { cout << "0" << endl; return 0; } } } cout << round(pow(2, (N - 1) / 2)) << endl; } else { if (aMap[0] != 0) { cout << "0" << endl; return 0; } for (int i = 1; i < N; ++i) { if (i % 2 == 0) { if (aMap[i] != 0) { cout << "0" << endl; return 0; } } else { if (aMap[i] != 2) { cout << "0" << endl; return 0; } } } cout << round(pow(2, N / 2)); } return 0; }
a.cc: In function 'int main()': a.cc:43:23: error: 'pow' was not declared in this scope 43 | cout << round(pow(2, (N - 1) / 2)) << endl; | ^~~ a.cc:43:17: error: 'round' was not declared in this scope 43 | cout << round(pow(2, (N - 1) / 2)) << endl; | ^~~~~ a.cc:62:23: error: 'pow' was not declared in this scope 62 | cout << round(pow(2, N / 2)); | ^~~ a.cc:62:17: error: 'round' was not declared in this scope 62 | cout << round(pow(2, N / 2)); | ^~~~~
s943661639
p03846
C++
#include <iostream> #include <unordered_map> using namespace std; int main() { #ifdef __APPLE__ freopen("input2.txt", "r", stdin); #endif int N; cin >> N; long a[N]; unordered_map<long, long> aMap; for (int i = 0; i < N; ++i) { cin >> a[i]; if (aMap.find(a[i]) == aMap.end()) { aMap[a[i]] = 1; } else { ++aMap[a[i]]; } } if (N % 2 == 1) { if (aMap[0] != 1) { cout << "0" << endl; return 0; } for (int i = 1; i < N; ++i) { if (i % 2 == 0) { if (aMap[i] != 2) { cout << "0" << endl; return 0; } } else { if (aMap[i] != 0) { cout << "0" << endl; return 0; } } } cout << round(pow(2, (N - 1) / 2)) << endl; } else { if (aMap[0] != 0) { cout << "0" << endl; return 0; } for (int i = 1; i < N; ++i) { if (i % 2 == 0) { if (aMap[i] != 0) { cout << "0" << endl; return 0; } } else { if (aMap[i] != 2) { cout << "0" << endl; return 0; } } } cout << round(pow(2, N / 2)); } return 0; }
a.cc: In function 'int main()': a.cc:44:23: error: 'pow' was not declared in this scope 44 | cout << round(pow(2, (N - 1) / 2)) << endl; | ^~~ a.cc:44:17: error: 'round' was not declared in this scope 44 | cout << round(pow(2, (N - 1) / 2)) << endl; | ^~~~~ a.cc:63:23: error: 'pow' was not declared in this scope 63 | cout << round(pow(2, N / 2)); | ^~~ a.cc:63:17: error: 'round' was not declared in this scope 63 | cout << round(pow(2, N / 2)); | ^~~~~
s303013527
p03846
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; const ll mod=1e9+7; int main() { int N; cin >> N; vector <ll> A(N); for (int i=0; i<N; i++) { cin >> A[i]; } if (N%2==1) { a.push_back(0); } sort(A.begin(),A.end()); for (int i=0; i<N; i+=2) { if (A[i]!=A[i+1]) { cout << 0 << endl; return 0; } } int ans=1; for(int i=0; i<N/2; i++) { ans*=2; ans%=mod; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:5: error: 'a' was not declared in this scope 16 | a.push_back(0); | ^
s801746747
p03846
C++
#include <iostream> #include <vector> using namespace std; typedef long long ll; const ll mod=1e9+7; int main() { int N; cin >> N; vector <ll> a(N); for (int i=0; i<N; i++) { cin >> a[i]; } if (N%2==1) { a.push_back(0); } sort(a.begin(),a.end()); for (int i=0; i<N; i+=2) { if (a[i]!=a[i+1]) { cout << 0 << endl; return 0; } } int ans=1; for(int i=0; i<N/2; i++) { ans*=2; ans%=mod; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:3: error: 'sort' was not declared in this scope; did you mean 'short'? 18 | sort(a.begin(),a.end()); | ^~~~ | short
s301393767
p03846
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[100001]; for(int i = 0 ; i < n ; i++) a[i] = sc.nextInt(); long ans = 1; for(int i = 0 ; i < n ; i++) b[a[i]]++; if(n % 2 == 0) { boolean ok = true; for(int j = 0 ; j * j < n ; j++) { if(b[j + 1] != 2) ok = false; } if(ok) { ans = 1L<<(n / 2) % 1000000007; } else { System.out.println(0); return; } } else { boolean ok = true; for(int j = 0 ; j * j < n ; j++) { if(j == 0 && b[j] != 1) ok = false; else if(b[j * 2] != 2) ok = false; } if(ok) { ans = 1L<<(n / 2) % 1000000007; } else { System.out.println(0); return; } } System.out.println(ans); } }
Main.java:7: error: incompatible types: possible lossy conversion from long to int int[] a = new int[n]; ^ 1 error
s148067250
p03846
C++
#include <iostream> #include <math.h> #include <algorithm> using namespace std; int main() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort (a, a + n); int ans1 = 0; if (n % 2 == 1) { int ans = 0; for (int i = 0; i < n; i++) { if (a[i] == 0) { ans++; } if (a[i] % 2 == 1) { cout << 0; return 0; } } if (ans != 1) { cout << 0; return 0; } for (int i = 1; i < n - 1; i += 2) { if (a[i] == a[i + 1]) { ans1 ++; } if (a[i] > 1) { if (a[i] == a[i - 2]) { cout << 0; return 0; } } } if (ans1 == n / 2) { cout << pow(2, n / 2)% (pow(10,9) + 7); return 0; } } else { for (int i = 0; i < n; i++) { if (a[i] % 2 == 0) { cout << 0; return 0; } } for (int i = 0; i < n - 1; i += 2) { if (a[i] == a[i + 1]) { ans1++; } if (a[i] > 1) { if (a[i] == a[i - 2]) { cout << 0; return 0; } } } if (ans1 == n / 2) { cout << pow(2, n / 2) % (pow(10,9) + 7); return 0; } } return 0; }
a.cc: In function 'int main()': a.cc:43:34: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 43 | cout << pow(2, n / 2)% (pow(10,9) + 7); | ~~~~~~~~~~~~~^ ~~~~~~~~~~~~~~~ | | | | | __gnu_cxx::__promote<double>::__type {aka double} | __gnu_cxx::__promote<double>::__type {aka double} a.cc:66:35: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 66 | cout << pow(2, n / 2) % (pow(10,9) + 7); | ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~ | | | | | __gnu_cxx::__promote<double>::__type {aka double} | __gnu_cxx::__promote<double>::__type {aka double}
s984455543
p03846
C++
#include <bits/stdc++.h> using namespace std; #define DEBUG(x) cerr << #x << ": " << x << endl; #define MAX 1000000007; int main() { int n; cin >> n; vector<int> A; for (int i = 0; i < n; i++) { int x; cin >> x; A.push_back(x); } vector<int> B; // 要素数が偶数の時 if (n % 2 == 0) { int nHalf = n / 2; int tmpN = n - 1; // 配列の前半埋める for (int i = 0; i < nHalf; i++) { B.push_back(tmpN); tmpN -= 2; } // 配列の後半埋める tmpN = 1; for (int i = 0; i < nHalf; i++) { B.push_back(tmpN); tmpN += 2; } } else { // 要素数が奇数 int nHalf = n / 2; int tmpN = n - 1; // 配列の前半埋める for (int i = 0; i < nHalf; i++) { B.push_back(tmpN); tmpN -= 2; } B.push_back(0); // 配列の後半埋める tmpN = 2; for (int i = 0; i < nHalf; i++) { B.push_back(tmpN); tmpN += 2; } } sort(A.begin(), A.end()); sort(B.begin(), B.end()); for (int i = 0; i < n; i++) { if (A[i] != B[i]) { cout << "0" << endl; return 0; // 一致しないならここで終了 } } int nHalf = n / 2; int ans = 1; for (int i = 0; i < nHalf; i++) { ans *= 2; } cout << ans % MAX << endl; return 0; }
a.cc: In function 'int main()': a.cc:66:23: error: expected primary-expression before '<<' token 66 | cout << ans % MAX << endl; | ^~
s912711051
p03846
C++
#include <bits\stdc++.h> using namespace std; int n,cnt[1000005],i,x; long long ans; int main() { cin>>n; for (i=1;i<=n;i++) { cin>>x; cnt[x]++; } if (n&1) { for (i=2;i<=n;i+=2) { if (cnt[i]!=2) { cout<<0; return 0; } } if (cnt[0]!=1) { cout<<0; return 0; } } else { for (i=1;i<=n;i+=2) { if (cnt[i]!=2) { cout<<0; return 0; } } } ans=1; for (i=1;i<=n/2;i++) (ans*=2)%=((long long)1e9+7); cout<<ans; return 0; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s845407028
p03846
C++
#include <bits\stdc++.h> using namespace std; int n,cnt[1000005],i,x; long long ans; int main() { cin>>n; for (i=1;i<=n;i++) { cin>>x; cnt[x]++; } if (n&1) { for (i=2;i<=n;i+=2) { if (cnt[i]!=2) { cout<<0; return 0; } } if (cnt[0]!=1) { cout<<0; return 0; } } else { for (i=1;i<=n;i+=2) { if (cnt[i]!=2) { cout<<0; return 0; } } } ans=1; for (i=1;i<=n/2;i++) (ans*=2)%=((long long)1e9+7); cout<<ans; return 0; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s531056551
p03846
C++
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <stack> #include <queue> #include <cctype> #include <cmath> #include <map> #include <set> #define rep(i, m, n) for(int i = m;i < n;i++) #define repr(i, n) for(int i = n;i >= 0;i--) #define ll long long #define ull unsigned long long #define push(a) push_back(a) #define pop(a) pop_back(a) #define debug(x) cout<<#x<<": "<<x<<endl #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define INF 999999999 using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; int main(){ ull n,a,b[100001]={},ans=1; cin>>n; rep(i,0,n){ cin>>b; a[b]++; } if(n%2==0){ rep(i,0,100001){ if(a[i]%2==0)ans*=2; } }else{ if(a[0]%2==0){ ans=0; }else{ rep(i,0,100001){ if(a[i]%2==0)ans*=2; } } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:35:12: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'long long unsigned int [100001]') 35 | cin>>b; | ~~~^~~ | | | | | long long unsigned int [100001] | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'long long unsigned int*' 35 | cin>>b; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long unsigned int*' to 'short int' [-fpermissive] 35 | cin>>b; | ^ | | | long long unsigned int* a.cc:35:14: error: cannot bind rvalue '(short int)((long long unsigned int*)(& b))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long unsigned int*' to 'short unsigned int' [-fpermissive] 35 | cin>>b; | ^ | | | long long unsigned int* a.cc:35:14: error: cannot bind rvalue '(short unsigned int)((long long unsigned int*)(& b))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long unsigned int*' to 'int' [-fpermissive] 35 | cin>>b; | ^ | | | long long unsigned int* a.cc:35:14: error: cannot bind rvalue '(int)((long long unsigned int*)(& b))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long unsigned int*' to 'unsigned int' [-fpermissive] 35 | cin>>b; | ^ | | | long long unsigned int* a.cc:35:14: error: cannot bind rvalue '(unsigned int)((long long unsigned int*)(& b))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long unsigned int*' to 'long int' [-fpermissive] 35 | cin>>b; | ^ | | | long long unsigned int* a.cc:35:14: error: cannot bind rvalue '(long int)((long long unsigned int*)(& b))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long unsigned int*' to 'long unsigned int' [-fpermissive] 35 | cin>>b; | ^ | | | long long unsigned int* a.cc:35:14: error: cannot bind rvalue '(long unsigned int)((long long unsigned int*)(& b))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long unsigned int*' to 'long long int' [-fpermissive] 35 | cin>>b; | ^ | | | long long unsigned int* a.cc:35:14: error: cannot bind rvalue '(long long int)((long long unsigned int*)(& b))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: invalid conversion from 'long long unsigned int*' to 'long long unsigned int' [-fpermissive] 35 | cin>>b; | ^ | | | long long unsigned int* a.cc:35:14: error: cannot bind rvalue '(long long unsigned int)((long long unsigned int*)(& b))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:35:14: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 35 | cin>>b; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'long long unsigned int [100001]' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'long long unsigned int [100001]' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'long long unsigned int [100001]' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'long long unsigned int [100001]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::
s554262923
p03846
C++
#include<iostream> using namespace std; #include<vector> #include<set> int main(){ int n; cin>>n; vector<int> a(n); vector<int> ans(n,0); long long int ansr=1; for(int i = 0;i<n;i++){ cin>>a[i]; ans[a[i]]++; } if(n%2==1)ans[0]++; for(int i = 1-n%2;i<n;i+=2){ if(ans[i]!=2){ cout<<0<<endl; return 0; } if(i!=0)ansr*=2; ansr%=1000000007 } cout<<ansr<<endl; return 0; }
a.cc: In function 'int main()': a.cc:23:33: error: expected ';' before '}' token 23 | ansr%=1000000007 | ^ | ; 24 | } | ~
s001720183
p03846
C++
#include <cstdio> #include <iostream> #include <cstdlib> #include <algorithm> #include <vector> #include <cstring> #include <queue> #include <stack> #include <functional> #include <set> #include <map> #include <deque> #define NMAX 100005 #define MMAX 103 //コメントアウトするとdebug()を実行しない #define DEBUG using namespace std; template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } int N,A[NMAX],ans = 1;; char C; string S; vector<int> T; static const int dx[8] = {0,1,1,1,0,-1,-1,-1}, dy[8] = {1,1,0,-1,-1,-1,0,1}; int solve(){ for (int i = 0; i < N; ++i) { T.push_back(); } sort(T.begin(), T.end(), greater<int>() ); if(!T[0]){ int j = 2; for (int i = 1; i < T.size(); ++i) { if(T[i] != j){ ans = 0; return 0; } if(!i%2){ j += 2; } } }else{ int j = 1; for (int i = 0; i < T.size(); ++i) { if(T[i] != j){ ans = 0; return 0; } if(i%2){ j += 2; } } } for (int i = 0; i < N/2; ++i) { ans *= 2; } return 0; } int main(){ cin >> N; for (int i = 0; i < N; ++i) { cin >> A[i]; } return 0; }
a.cc: In function 'int solve()': a.cc:35:28: error: no matching function for call to 'std::vector<int>::push_back()' 35 | T.push_back(); | ~~~~~~~~~~~^~ In file included from /usr/include/c++/14/vector:66, from a.cc:5: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate expects 1 argument, 0 provided