submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s033573375 | p03665 | C++ |
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 998244353;//1000000007;
template<class _T> static void getval(_T& a) {
std::cin >> a;
}
template<class _T> static void getval(_T& a, _T& b) {
std::cin >> a >> b;
}
template<class _T> static void getval(_T& a, _T& b, _T& c) {
std::cin >> a >> b >> c;
}
static void exec();
int main()
{
exec();
fflush(stdout);
return 0;
}
static void exec()
{
int N, P;
getval(N, P);
int a, odd = 0;
for (int i = 0; i < N; i++) {
getval(a);
if (a % 2) odd++;
}
LLONG ans = 0;
if (odd == 0 && P) {
printf("%lld\n", ans);
return;
}
if (odd) {
ans = tp_pow<LLONG>(2, N - 1);
}
else {
ans = tp_pow<LLONG>(2, N);
}
printf("%lld\n", ans);
}
| a.cc: In function 'void exec()':
a.cc:56:23: error: 'tp_pow' was not declared in this scope
56 | ans = tp_pow<LLONG>(2, N - 1);
| ^~~~~~
a.cc:56:35: error: expected primary-expression before '>' token
56 | ans = tp_pow<LLONG>(2, N - 1);
| ^
a.cc:59:23: error: 'tp_pow' was not declared in this scope
59 | ans = tp_pow<LLONG>(2, N);
| ^~~~~~
a.cc:59:35: error: expected primary-expression before '>' token
59 | ans = tp_pow<LLONG>(2, N);
| ^
|
s902760725 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main(){
ll n,p;
cin >> n >> p;
ll k = 0;
for (ll i = 0; i < n; i++) {
ll t;
cin >> t;
if (t % 2 == 1) t++;
}
if(t==0){
if (p == 0) cout << round(pow(2,n)) << endl;
else
cout << 0 << endl;
}
else
cout << round(pow(2, n - 1)) << endl;
} | a.cc: In function 'int main()':
a.cc:31:4: error: 't' was not declared in this scope
31 | if(t==0){
| ^
|
s174932802 | p03665 | C++ | #include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;
//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX_N; i++) {
fac[i] = fac[i - 1] * i;
}
}
// 二項係数計算
long long COM(ll n, ll k) {
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
if (n > k * 2) {
}
return fac[n] / (fac[k] * fac[n - k]);
}
ll dp[201010][2];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
//long longしか使わない
//素数は1より大きい
int main() {
ll n, p;
cin >> n >> p;
vector<ll>a(n);
bool flag = false;
rep(i, n) {
cin >> a[i];
if (a[i] % 2)flag = true;
}
ans = 1;
if (flag) {
rep(i, n - 1) {
ans *= 2;
}
}
else {
rep(i, n) {
ans *= 2;
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:72:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
72 | ans = 1;
| ^~~
| abs
|
s777466534 | p03665 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
typedef long long ll;
ll mypow(ll x, ll n){
if(n == 0)
return 1;
if(n % 2 == 0)
return mypow(x * x, n / 2);
else
return x * mypow(x, n - 1);
}
//参考http://izumi-math.jp/I_Yanagita/binomial_theorem1.pdf
int main() {
ll n, p;
cin >> n >> p;
int odd_number_count = 0;
rep(i, n) {
if(a % 2 != 0)odd_number_count++;
}
if(odd_number_count == 0){
if(p == 0){
cout << mypow(2, n) << endl;
return 0;
}else {
cout << 0 << endl;
return 0;
}
}
cout << mypow(2, n - 1) << endl;
} | a.cc: In function 'int main()':
a.cc:24:8: error: 'a' was not declared in this scope
24 | if(a % 2 != 0)odd_number_count++;
| ^
|
s011475849 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif
class Combination {
private:
const int64_t mod = 1e16;
vector<vector<int64_t>> comb;
void init(int64_t max_size) {
comb.assign(max_size, vector<int64_t>(max_size, 0));
comb[0][0] = 1;
for (auto i = 1; i < max_size; i++) {
// 0個選ぶ組み合わせは1つしかない
comb[i][0] = 1;
for (auto j = 1; j < max_size; j++) {
comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % mod;
}
}
};
public:;
explicit Combination(int64_t max_size) {
assert(max_size <= 2000);
// テーブル生成
init(max_size + 1);
};
virtual ~Combination() = default;
int64_t combination(int64_t n, int64_t k) {
if (n < k) return 0;
if (n < 0 or k < 0) return 0;
return comb[n][k];
};
};
int main(){
int n, p; cin >> n >> p;
Combination c = Combination(50);
vector<int> a(n);
int odd = 0;
for (auto i = 0; i < n; i++) {
cin >> a[i];
if(a[i] % 2) odd++;
}
int64_t all_comb = 0, odd_comb = 0, even_comb = 0;
for (auto i = 0; i <= n; i++) {
all_comb += c.combination(n, i);
if(odd >= i and i % 2) odd_comb += c.combination(odd, i);
if(n - odd >= i) even_comb += c.combination(n - odd, i);
cout << i << " " << all_comb << " " << odd_comb << " " << even_comb << endl;
}
if(p == 0) {
cout << all_comb - odd_comb * even_comb << endl;
} else {
cout << odd_comb * even_comb << endl;
}
return 0;
}#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif
class Combination {
private:
const int64_t mod = 1e16;
vector<vector<int64_t>> comb;
void init(int64_t max_size) {
comb.assign(max_size, vector<int64_t>(max_size, 0));
comb[0][0] = 1;
for (auto i = 1; i < max_size; i++) {
// 0個選ぶ組み合わせは1つしかない
comb[i][0] = 1;
for (auto j = 1; j < max_size; j++) {
comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % mod;
}
}
};
public:;
explicit Combination(int64_t max_size) {
assert(max_size <= 2000);
// テーブル生成
init(max_size + 1);
};
virtual ~Combination() = default;
int64_t combination(int64_t n, int64_t k) {
if (n < k) return 0;
if (n < 0 or k < 0) return 0;
return comb[n][k];
};
};
int main(){
int n, p; cin >> n >> p;
Combination c = Combination(50);
vector<int> a(n);
int odd = 0;
for (auto i = 0; i < n; i++) {
cin >> a[i];
if(a[i] % 2) odd++;
}
int64_t all_comb = 0, odd_comb = 0, even_comb = 0;
for (auto i = 0; i <= n; i++) {
all_comb += c.combination(n, i);
if(odd >= i and i % 2) odd_comb += c.combination(odd, i);
if(n - odd >= i) even_comb += c.combination(n - odd, i);
// cout << i << " " << all_comb << " " << odd_comb << " " << even_comb << endl;
}
if(p == 0) {
cout << all_comb - odd_comb * even_comb << endl;
} else {
cout << odd_comb * even_comb << endl;
}
return 0;
} | a.cc:66:2: error: stray '#' in program
66 | }#include <bits/stdc++.h>
| ^
a.cc:66:3: error: 'include' does not name a type
66 | }#include <bits/stdc++.h>
| ^~~~~~~
a.cc:74:7: error: redefinition of 'class Combination'
74 | class Combination {
| ^~~~~~~~~~~
a.cc:9:7: note: previous definition of 'class Combination'
9 | class Combination {
| ^~~~~~~~~~~
a.cc:105:5: error: redefinition of 'int main()'
105 | int main(){
| ^~~~
a.cc:40:5: note: 'int main()' previously defined here
40 | int main(){
| ^~~~
|
s748067526 | p03665 | C++ | #include <iostream>
#define ll long long
using namespace std;
int n, p, value[105];
ll memo[55][5005];
ll calculate(int i, ll sum){
if(memo[i][sum]!=-1)return memo[i][sum];
if(i>n){
if(sum%2== p)return 1;
else return 0;
}
ll t = calculate(i+1, sum+value[i]);
ll nt = calculate(i+1, sum);
memo[i][sum]=t+nt;
return memo[i][sum];
}
int main(){
memset(memo, -1, sizeof(memo));
cin >> n >> p;
for(int i=1; i<=n; i++){
cin >> value[i];
}
cout << calculate(1, 0)<< endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:5: error: 'memset' was not declared in this scope
18 | memset(memo, -1, sizeof(memo));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | #define ll long long
|
s172358586 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,p; cin>>n>>p;
int m =0;
for(int i=0;i<n;i++){
int a; cin>>a;
if(a %2 == p) ++m;
}
if(m == 0)
cout<< ( (p == 0? (1LL<<n):0) <<endl;
else
cout<<(1LL<<(n-1)) <<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:35: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<<'
16 | cout<< ( (p == 0? (1LL<<n):0) <<endl;
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~
a.cc:16:41: error: expected ')' before ';' token
16 | cout<< ( (p == 0? (1LL<<n):0) <<endl;
| ~ ^
| )
|
s846753124 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,p; cin>>n>>p;
int m =0;
for(int i=0;i<n;i++){
int a; cin>>a;
if(a %2 == p) ++m;
}
if(m == 0)
cout<< (p == 0)?(1LL<<N):0) <<endl;
else
cout<<(1LL<<(N-1)) <<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:27: error: 'N' was not declared in this scope
16 | cout<< (p == 0)?(1LL<<N):0) <<endl;
| ^
a.cc:18:18: error: 'N' was not declared in this scope
18 | cout<<(1LL<<(N-1)) <<endl;
| ^
|
s649108442 | p03665 | C++ | void solve(long long N, long long P, std::vector<long long> A) {
int one = 0;
long long tmp = 0;
for(int i =0 ;i<N;i++)if(A[i]%2)one = 1;
if(one == 0){
if(P == 1)tmp = 0;
else tmp = 1ll<<N;
}
else tmp = 1ll<<N-1;
cout<<tmp<<'\n';
} | a.cc:1:38: error: 'std::vector' has not been declared
1 | void solve(long long N, long long P, std::vector<long long> A) {
| ^~~
a.cc:1:49: error: expected ',' or '...' before '<' token
1 | void solve(long long N, long long P, std::vector<long long> A) {
| ^
a.cc: In function 'void solve(long long int, long long int, int)':
a.cc:4:29: error: 'A' was not declared in this scope
4 | for(int i =0 ;i<N;i++)if(A[i]%2)one = 1;
| ^
a.cc:10:3: error: 'cout' was not declared in this scope
10 | cout<<tmp<<'\n';
| ^~~~
|
s881540468 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 2;
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 2;
void solve(long long N, long long P, std::vector<long long> A) {
int one = 0;
long long tmp = 0;
for(int i =0 ;i<N;i++)if(A[i]%2)one = 1;
if(one == 0){
if(P == 1)tmp = 0;
else tmp = 1ll<<N;
}
else tmp = 1ll<<N-1;
cout<<tmp<<'\n';
}
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
long long N;
scanf("%lld", &N);
long long P;
scanf("%lld", &P);
std::vector<long long> A(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &A[i]);
}
solve(N, P, std::move(A));
return 0;
}
void solve(long long N, long long P, std::vector<long long> A) {}
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
long long N;
scanf("%lld", &N);
long long P;
scanf("%lld", &P);
std::vector<long long> A(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &A[i]);
}
solve(N, P, std::move(A));
return 0;
}
| a.cc:8:17: error: redefinition of 'const long long int MOD'
8 | const long long MOD = 2;
| ^~~
a.cc:4:17: note: 'const long long int MOD' previously defined here
4 | const long long MOD = 2;
| ^~~
a.cc:38:6: error: redefinition of 'void solve(long long int, long long int, std::vector<long long int>)'
38 | void solve(long long N, long long P, std::vector<long long> A) {}
| ^~~~~
a.cc:10:6: note: 'void solve(long long int, long long int, std::vector<long long int>)' previously defined here
10 | void solve(long long N, long long P, std::vector<long long> A) {
| ^~~~~
a.cc:43:5: error: redefinition of 'int main()'
43 | int main() {
| ^~~~
a.cc:25:5: note: 'int main()' previously defined here
25 | int main() {
| ^~~~
|
s101527351 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 2;
void solve(long long N, long long P, std::vector<long long> A) {
int one = 0;
long long tmp = 0;
for(int i =0 ;i<N;i++)if(A[i]%2)one = 1;
if(one == 0){
if(P == 1)tmp = 0;
else tmp = 1ll<<n;
}
else tmp = 1ll<<n-1;
cout<<tmp<<'\n';
}
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
long long N;
scanf("%lld", &N);
long long P;
scanf("%lld", &P);
std::vector<long long> A(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &A[i]);
}
solve(N, P, std::move(A));
return 0;
}
| a.cc: In function 'void solve(long long int, long long int, std::vector<long long int>)':
a.cc:12:24: error: 'n' was not declared in this scope
12 | else tmp = 1ll<<n;
| ^
a.cc:14:23: error: 'n' was not declared in this scope
14 | else tmp = 1ll<<n-1;
| ^
|
s123526610 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 2;
void solve(long long N, long long P, std::vector<long long> A) {
int one = 0;
for(int i =0 ;i<N;i++)if(A[i]%2)one = 1;
if(one == 0){
if(P == 1)cout<<0;
else cout<<(ll)pow(2,N);
}
else cout<<(ll)pow(2,N-1);
}
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
long long N;
scanf("%lld", &N);
long long P;
scanf("%lld", &P);
std::vector<long long> A(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &A[i]);
}
solve(N, P, std::move(A));
return 0;
}
| a.cc: In function 'void solve(long long int, long long int, std::vector<long long int>)':
a.cc:11:20: error: 'll' was not declared in this scope
11 | else cout<<(ll)pow(2,N);
| ^~
a.cc:13:19: error: 'll' was not declared in this scope
13 | else cout<<(ll)pow(2,N-1);
| ^~
|
s447460989 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 2;
void solve(long long N, long long P, std::vector<long long> A) {
int one = 0;
for(int i =0 ;i<N;i++}if(A[i]%2)one = 1;
if(one){
if(P == 1)return cout<<0;
else return cout<<pow(2,n);
}
else return cout<<pow(2,n-1);
}
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
long long N;
scanf("%lld", &N);
long long P;
scanf("%lld", &P);
std::vector<long long> A(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &A[i]);
}
solve(N, P, std::move(A));
return 0;
}
| a.cc: In function 'void solve(long long int, long long int, std::vector<long long int>)':
a.cc:8:25: error: expected ')' before '}' token
8 | for(int i =0 ;i<N;i++}if(A[i]%2)one = 1;
| ~ ^
| )
a.cc:8:25: error: expected primary-expression before '}' token
a.cc: At global scope:
a.cc:8:26: error: expected unqualified-id before 'if'
8 | for(int i =0 ;i<N;i++}if(A[i]%2)one = 1;
| ^~
a.cc:9:6: error: expected unqualified-id before 'if'
9 | if(one){
| ^~
a.cc:13:7: error: expected unqualified-id before 'else'
13 | else return cout<<pow(2,n-1);
| ^~~~
a.cc:14:1: error: expected declaration before '}' token
14 | }
| ^
|
s425602509 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll combo(ll a, ll b){
if(b==0) return 1;
else{
ll ue=1;
ll shita=1;
for(ll i=a; i>=a-b+1; i--) ue*=i;
for(ll i=1; i<=b; i++) shita*=i;
return ue/shita;
}
}
int main(){
ll N, P; cin>>N>>P;
vector<ll> B(N);
ll odd=0;
ll even=0;
for(ll i=0; i<N; i++){
ll A; cin>>A;
if(A%2==0) even++;
if(A%2==1) odd++;
}
if(odd==0) ll ans=pow(2, N);
else ll ans=pow(2, N-1);
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:28:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
28 | cout<<ans<<endl;
| ^~~
| abs
|
s091795899 | p03665 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int p = sc.nextInt();
int odd = 0;
for (int i = 0; i < n; i++) {
if (sc.nextInt() % 2 == 1) {
odd++;
}
}
if (odd < 1) {
System.out.println(p == 0 ? (long) Math.pow(2, n) : 0);
} else {
System.out.println((long) Math.pow(2, n - 1));
}
| Main.java:20: error: reached end of file while parsing
}
^
1 error
|
s121260047 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long n,p,one=0,zero=0,a,ans;
cin>>n>>p;
for(int i=0;i<n;i++){
cin>>a;
if(a%2==0){
zero++;
}
else{
one++;
}
}/
if(p==1 && one==0){
cout<<"0"<<endl;
}
else{
cout<<pow(2,n-1)<<endl;
}
return(0);
} | a.cc: In function 'int main()':
a.cc:14:10: error: expected primary-expression before '/' token
14 | }/
| ^
a.cc:15:9: error: expected primary-expression before 'if'
15 | if(p==1 && one==0){
| ^~
a.cc:18:9: error: 'else' without a previous 'if'
18 | else{
| ^~~~
|
s515301773 | p03665 | C++ | #include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;
ll ncn(ll n){
if(n == 1){return 2;}
return ncn(n-1)*3*n;
}
int main(){
ll N,P; cin >> N >> P;
vll a(N);
vll even(0), odd(0);
for(int i=0; i<N; i++){
cin >> a[i];
if(a[i]%2==0){even.emplace_back(a[i]);}
else{odd.emplace_back(a[i]);}
}
ll A = even.size(), B = odd.size();
if(B==0&&P%2==1){
cout << 0;
}else if(B==0&&P%==0){
ll ans = 2;
for(int i=1; i<N; i++){
ans *= 2;
}
cout << ans;
}
else{
ll ans = 2;
for(int i=1; i<N-1; i++){
ans *= 2;
}
cout << ans;
}
} | a.cc: In function 'int main()':
a.cc:29:23: error: expected primary-expression before '=' token
29 | }else if(B==0&&P%==0){
| ^
|
s434331872 | p03665 | Java | import java.math.BigDecimal;
import java.util.*;
public class Math {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int p = sc.nextInt();
int o = 0, e = 0;
for (int i = 0; i < n; i++) {
int x = sc.nextInt();
if(x % 2 == 0){
e++;
}else{
o++;
}
}
BigDecimal ans = new BigDecimal(0);
for (int i = p; i <= o; i+=2) {
for (int j = 0; j <= e; j++) {
BigDecimal t = new BigDecimal(1).multiply(comb(o, i)).multiply(comb(e, j));
ans = ans.add(t);
}
}
System.out.println(ans);
sc.close();
}
private static BigDecimal comb(int n, int r){
BigDecimal ret = new BigDecimal(1);
for (int i = 0; i < Math.min(r, n-r); i++) {
ret = ret.multiply(new BigDecimal(n-i));
}
for (int i = 1; i <= Math.min(r, n-r); i++) {
ret = ret.divide(new BigDecimal(i));
}
return ret;
}
}
| Main.java:4: error: class Math is public, should be declared in a file named Math.java
public class Math {
^
Main.java:33: error: cannot find symbol
for (int i = 0; i < Math.min(r, n-r); i++) {
^
symbol: method min(int,int)
location: class Math
Main.java:36: error: cannot find symbol
for (int i = 1; i <= Math.min(r, n-r); i++) {
^
symbol: method min(int,int)
location: class Math
3 errors
|
s236772014 | p03665 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}
/*nCk*/
ll nckused[1000][1000];
ll nckreached[1000][1000];
ll comb(ll n,ll k){
if(n>1000) return (k==0 || k==n)?1:comb(n-1,k-1)+comb(n-1,k);
if(nckreached[n][k]==1) return nckused[n][k];
nckreached[n][k] = 1;
nckused[n][k] = (n==1 || (k==0 || k==n) )?1:comb(n-1,k-1)+comb(n-1,k);
return (n==1 || (k==0 || k==n) )?1:comb(n-1,k-1)+comb(n-1,k);
}
int main(void){
// char ;
ll n,p,ans=0;
scanf("%lld%lld",&n,&p);
ll a[n],odd=0,even=0;
rep(i,0,n){
scanf("%lld",&a[i]);
if(a[i]%2) odd++;
else even++;
}
if(p){
rep(i,1,odd+1){
if(i%2){
ans+=comb(odd,i);
}
}
ans*=POW(2,even);
}else{
rep(i,0,odd+1){
if(i%2==0){
ans+=comb(odd,i);
}
}
ans*=POW(2,even);
}
printf("%lld\n",ans);
return 0;
}
| a.cc:24:21: error: use of parameter outside function body before ']' token
24 | ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
| ^
a.cc: In function 'll minn(...)':
a.cc:24:41: error: 'n' was not declared in this scope
24 | ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
| ^
a.cc:8:35: note: in definition of macro 'rep'
8 | #define rep(i,l,r)for(ll i=(l);i<(r);i++)
| ^
a.cc:24:53: error: 'a' was not declared in this scope
24 | ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
| ^
a.cc: At global scope:
a.cc:25:21: error: use of parameter outside function body before ']' token
25 | ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
| ^
a.cc: In function 'll maxn(...)':
a.cc:25:42: error: 'n' was not declared in this scope
25 | ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
| ^
a.cc:8:35: note: in definition of macro 'rep'
8 | #define rep(i,l,r)for(ll i=(l);i<(r);i++)
| ^
a.cc:25:54: error: 'a' was not declared in this scope
25 | ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
| ^
|
s773093329 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define all(a) (a).begin(),(a).end()
#define elif else if
int low(V<int> a,int b){
decltype(a)::iterator c=lower_bound(a.begin(),a.end(),b);
int d=c-a.bgn;
return d;
}
int upp(V<int> a,int b){
decltype(a)::iterator c=upper_bound(a.begin(),a.end(),b);
int d=c-a.bgn;
return d;
}
int keta(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int gcd(int a,int b){
if(a%b==0)
return b;
return gcd(b,a%b);
}
int ketas(int a){
string b=to_string(a);
int c=0;
fo(i,keta(a)){
c+=b[i]-'0';
}
return c;
}
int INF=1000000007;
int kaijou(int a){
int b=1;
fo(i,a)
b*=i+1;
return b;
}
V<P<int,int>> factorize(int n){
V<P<int,int>> res;
for(int i=2; i*i<=n; i++){
if(n%i)
continue;
res.emplace_back(i,0);
while(n%i==0){
n/=i;
res.back().second++;
}
}
if(n!=1)
res.emplace_back(n,1);
return res;
}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
string s;
int a[500010];
signed main(){
int n,p;
cin>>n>>p;
V<int> a(n);
fo(i,n){
cin>>a[i];
}
if(p==0){
int b=1;
fo(i,n){
if(a[i]%==1){
b=0;
break;
}
}
if(b){
cout<<pow(2,n)<<endl;
return 0;
}
}
if(p==1){
int b=1;
fo(i,n){
if(a[i]%=~1){
b=0;
break;
}
}
if(b){
cout<<0<<endl;
return 0;
}
}
int c=n-1;
cout<<pow(2,c)<<endl;
}
| a.cc: In function 'int main()':
a.cc:99:16: error: expected primary-expression before '=' token
99 | if(a[i]%==1){
| ^
|
s124116251 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int ctoi(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
return 0;
}
int main(){
ll n,p;cin>>n>>p;
vl a(n);
rep(i,n)cin>>a[i];
ll cnt1=0,cnt2=0;
rep(i,n){
if(a[i]%2==0)cnt1++;
else cnt2++;
}
if(n==1){
if(p==1&&a[0]%2==0){
cout<<0<<endl;
return 0;
}
}
if(cnt1==n&&&p==1){
cout<<0<<endl;
return 0;
}
ll ans=1;
while(cnt1>0){
ans*=2;
cnt1--;
}
while(cnt2>1){
ans*=2;
cnt2--;
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:61:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
61 | if(cnt1==n&&&p==1){
| ~~^~~
|
s494251998 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n,p;
cin >> n >> p;
long long a[n];
for(int i=0;i<n;i++){
cin >> a[i];
a[i]=a[i]%2;
}
long long dp[n+1];
long long k[n+1];
k[0]=1
for(int i=1;i<+n;i++){
k[i]=k[i-1]*2;
}
dp[0]=1;
for(int i=1;i<=n;i++){
if(a[i]%2==0){
dp[i]=dp[i-1]*2;
}
else{
dp[i]=(k[i-1]-dp[i-1])*2;
}
}
if(p==0) cout << dp[n] << endl;
else cout << k[n]-dp[n] << endl;
} | a.cc: In function 'int main()':
a.cc:14:11: error: expected ';' before 'for'
14 | k[0]=1
| ^
| ;
15 | for(int i=1;i<+n;i++){
| ~~~
a.cc:15:17: error: 'i' was not declared in this scope
15 | for(int i=1;i<+n;i++){
| ^
|
s989556648 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,P,O=0,E=0,x,A;cin>>N>>P;
for(int i=0;i<N;i++){
cin>>A;
if(A%2==0)E++;
else O++;
}
if(O%2==1)x=pow(2,O-1);
else{
long long int s=1,t=1;
for(int i=1;i<=O/2;i++)s*=i;
for(int i=O/2+1;i<=O;i++)t*=i;
if(P==0)x=(pow(2,O)-t/s)/2;
else x=(pow(2,O)+t/s)/2;
}
cout<<pow(2*E)*x<<endl;
} | a.cc: In function 'int main()':
a.cc:18:12: error: no matching function for call to 'pow(int)'
18 | cout<<pow(2*E)*x<<endl;
| ~~~^~~~~
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
from a.cc:1:
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Constant, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_Constant, _Tp, _Tp>, _Tp> std::pow(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const valarray<_Tp>&, const valarray<_Tp>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const valarray<typename _Dom::valarray>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename _Dom1::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:2482:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const complex<_Tp>&, const complex<_Up>&)'
2482 | pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
| ^~~
/usr/include/c++/14/complex:2482:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:2474:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const _Tp&, const complex<_Up>&)'
2474 | pow(const _Tp& __x, const std::complex<_Up>& __y)
| ^~~
/usr/include/c++/14/complex:2474:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:2466:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const complex<_Tp>&, const _Up&)'
2466 | pow(const std::complex<_Tp>& __x, const _Up& __y)
| ^~~
/usr/include/c++/14/complex:2466:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:1339:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const _Tp&, const complex<_Tp>&)'
1339 | pow(const _Tp& __x, const complex<_Tp>& __y)
| ^~~
/usr/include/c++/14/complex:1339:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:1328:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, const complex<_Tp>&)'
1328 | pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~
/usr/include/c++/14/complex:1328:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:1294:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, const _Tp&)'
1294 | pow(const complex<_Tp>& __x, const _Tp& __y)
| ^~~
/usr/include/c++/14/complex:1294:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:1285:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, int)'
1285 | pow(const complex<_Tp>& __z, int __n)
| ^~~
/usr/include/c++/14/complex:1285:5: note: candidate expects 2 arguments, 1 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:114:
/usr/include/c++/14/cmath:1074:5: note: candidate: 'template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)'
1074 | pow(_Tp __x, _Up __y)
| ^~~
/usr/include/c++/14/cmath:1074:5: note: candidate expects 2 arguments, 1 provided
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate: 'double pow(double, double)'
173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
| ^~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/cmath:380:3: note: candidate: 'constexpr long double std::pow(long double, long double)'
380 | pow(long double __x, long double __y)
| ^~~
/usr/include/c++/14/cmath:380:3: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/cmath:376:3: note: candidate: 'constexpr float std::pow(float, float)'
376 | pow(float __x, float __y)
| ^~~
/usr/include/c++/14/cmath:376:3: note: candidate expects 2 arguments, 1 provided
|
s820264086 | p03665 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#define DIV LLONG_MAX
long long mypow(long long k, long long n) {
long long temp = 1;
k = k % DIV;
while (n) {
if (n % 2) temp = temp * k % DIV;
k = k * k % DIV;
n = n / 2;
}
return temp % DIV;
}
long long cmb(long long n, long long r) {
long long x = 1, y = 1, y_inv;
long long min;
if (n - r > r) min = r;
else min = n - r;
for (long long i = 0; i < min; i++) {
x = x * (n - i) % DIV;
y = y * (i + 1) % DIV;
}
return x * y % DIV;
}
int main(){
int n,p;
int a;
long long zero_cnt = 0, one_cnt = 0;
long long ans = 0;
scanf("%d %d", &n, &p);
for (int i = 0; i < n; i++) {
scanf("%d", &a);
if (a % 2)one_cnt++;
else zero_cnt++;
}
if (p) {
for (long long i = 0; 2 * i + 1 <= one_cnt; i++)
ans += cmb(one_cnt, 2 * i + 1);
}
else {
for (long long i = 0; 2 * i <= one_cnt; i++)
ans += cmb(one_cnt, 2 * i);
}
ans = ans * mypow(2, zero_cnt);
printf("%lld", ans);
return 0;
| main.c: In function 'main':
main.c:53:9: error: expected declaration or statement at end of input
53 | return 0;
| ^~~~~~
|
s476985764 | p03665 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#define DIV LLONG_MAX
long long mypow(long long k, long long n) {
long long temp = 1;
k = k % DIV;
while (n) {
if (n % 2) temp = temp * k % DIV;
k = k * k % DIV;
n = n / 2;
}
return temp % DIV;
}
long long cmb(long long n, long long r) {
long long x = 1, y = 1, y_inv;
long long min;
if (n - r > r) min = r;
else min = n - r;
for (long long i = 0; i < min; i++) {
x = x * (n - i) % DIV;
y = y * (i + 1) % DIV;
}
return x * y % DIV;
}
int main(){
int n,p;
int a;
long long zero_cnt = 0, one_cnt = 0;
long long ans = 0;
scanf("%d %d", &n, &p);
for (int i = 0; i < n; i++) {
scanf("%d", &a);
if (a % 2)one_cnt++;
else zero_cnt++;
}
if (p) {
for (long long i = 0; 2 * i + 1 <= one_cnt; i++)
ans += cmb(one_cnt, 2 * i + 1);
}
else {
for (long long i = 0; 2 * i <= one_cnt; i++)
ans += cmb(one_cnt, 2 * i);
}
ans = ans * mypow(2, zero_cnt);
printf("%lld", ans);
return 0;
| a.cc: In function 'int main()':
a.cc:53:18: error: expected '}' at end of input
53 | return 0;
| ^
a.cc:31:11: note: to match this '{'
31 | int main(){
| ^
|
s103365617 | p03665 | C++ | #include<iostream>
#include <bits/stdc++.h>
#include <cmath>
int main()
{
int N,P;
cin >> N >> P;
vector<int> vec(N);
for (int i=0; i<N; i++){
cin >> vec[i];
}
int even;
double odd;
even=0;
odd=0;
for (int i=0;i<N;i++){
if (vec[i]%2==0){
even++;
}
}
odd = N-even;
int ans;
if (P%2==0){
ans=std::pow(2,even)*floor(odd/2+1);
}
if (P%2==1){
ans=std::pow(2,even)*floor(odd/2+1);
}
cout << ans<< endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
8 | cin >> N >> P;
| ^~~
| 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:9:3: error: 'vector' was not declared in this scope
9 | vector<int> vec(N);
| ^~~~~~
a.cc:9:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:9:10: error: expected primary-expression before 'int'
9 | vector<int> vec(N);
| ^~~
a.cc:12:12: error: 'vec' was not declared in this scope
12 | cin >> vec[i];
| ^~~
a.cc:21:9: error: 'vec' was not declared in this scope
21 | if (vec[i]%2==0){
| ^~~
a.cc:35:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
35 | 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:35:17: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
35 | cout << ans<< 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)
| ^~~~
|
s522616884 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,P;
cin >> N >> P;
vector<int> A(N);
int E = 0;
int O = 0;
for (int i = 0; i < N; i++){
cin >> A[i];
if (A[i] % 2 == 0) E++;
if (A[i] % 2 == 1) O++;
}
long long ans = 1;
for (int i = 0; i < E; i++) ans*=2;
//Calculate binomial coefficients
vector<vector<long long>> B(O + 1,vector<int>(O + 1));
for (int i = 1; i <= O; i++){
B[i][0] = 1;
B[i][i] = 1;
for (int j = 1; j < i; j++){
B[i][j] = B[i - 1][j] + B[i - 1][j - 1];
}
}
long long p = 0;
for (int i = P; i <= O; i+=2){
p += B[O][i];
}
cout << ans * p;
} | a.cc: In function 'int main()':
a.cc:17:55: error: no matching function for call to 'std::vector<std::vector<long long int> >::vector(int, std::vector<int>)'
17 | vector<vector<long long>> B(O + 1,vector<int>(O + 1));
| ^
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed:
a.cc:17:55: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>')
17 | vector<vector<long long>> B(O + 1,vector<int>(O + 1));
| ^
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; allocator_type = std::allocator<std::vector<long long int> >]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<long long int> >'
678 | vector(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<long long int> >]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<long long int> >&&'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; allocator_type = std::allocator<std::vector<long long int> >; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; allocator_type = std::allocator<std::vector<long long int> >; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<long long int> >]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<long long int> >&'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; size_type = long unsigned int; value_type = std::vector<long long int>; allocator_type = std::allocator<std::vector<long long int> >]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<long long int> >::value_type&' {aka 'const std::vector<long long int>&'}
569 | vector(size_type __n, const value_type& __value,
| ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<long long int> >]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<long long int> >::allocator_type&' {aka 'const std::allocator<std::vector<long long int> >&'}
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; allocator_type = std::allocator<std::vector<long long int> >]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
|
s417065186 | p03665 | C++ | #include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll h(ll n,ll j){
ll k=1;
for(int i=n;i>=n-j+1;i--){
k*=i;
}
for(int i=j,i>0;j--){
k/=i;
}
return k;
}
ll kk(ll n){
ll k=1;
rep(i,n){
k*=2;
}
return k;
}
int main(){
ll n,p;
cin>>n>>p;
vll a(n);
ll a0=0;
ll a1=0;
rep(i,n){
cin>>a[i];
if(a[i]%2==0) a0++;
else a1++;
}
sort(all(a));
ll ans=0;
if(p){
ans+=a1;
ll k=3;
while(a1-k>=1){
ans+=h(a1,k);
k+=2;
}
ans*=kk(a0);
COUT(ans);
}
else{
ll k=2;
while(a1-k>=1){
ans+=h(a1,k);
k+=2;
}
ans*=kk(a0);
}
COUT(ans);
}
| a.cc: In function 'long long int h(long long int, long long int)':
a.cc:41:16: error: expected ';' before '>' token
41 | for(int i=j,i>0;j--){
| ^
| ;
a.cc:41:16: error: expected primary-expression before '>' token
|
s959202092 | p03665 | C++ | #include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll h(ll n,ll j){
ll k=1;
for(int i=n;i>=n-j+1;i--){
k*=i;
}
for(int i=j,i>0;j--){
k/=i;
}
return k;
}
ll kk(ll n){
ll k=1;
rep(i,n){
k*=2;
}
return k;
}
int main(){
ll n,p;
cin>>n>>p;
vll a(n);
ll a0=0;
ll a1=0;
rep(i,n){
cin>>a[i];
if(a[i]%2==0) a0++;
else a1++;
}
sort(all(a));
ll ans=0;
if(p){
ans+=a1;
ll k=3;
while(a1-k>=1){
ans+=h(a1,k);
k+=2;
}
ans*=kk(a0);
COUT(ans);
}
else{
ll k=2;
while(a1-k>=1){
ans+=h(a1,k);
k+=2;
}
ans*=kk(a0);
| a.cc: In function 'long long int h(long long int, long long int)':
a.cc:41:16: error: expected ';' before '>' token
41 | for(int i=j,i>0;j--){
| ^
| ;
a.cc:41:16: error: expected primary-expression before '>' token
a.cc: In function 'int main()':
a.cc:82:17: error: expected '}' at end of input
82 | ans*=kk(a0);
| ^
a.cc:76:7: note: to match this '{'
76 | else{
| ^
a.cc:82:17: error: expected '}' at end of input
82 | ans*=kk(a0);
| ^
a.cc:53:11: note: to match this '{'
53 | int main(){
| ^
|
s852980319 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
int N,P; cin>>N>>P;
vii A(N+1,vi(2));
REP(i,1,N){
int X; cin>>X;
if(X%2==0){
dp[i][0]=dp[i-1][0]+1;
dp[i][1]=dp[i-1][1]+1;
}
else{
dp[i][0]=dp[i-1][1]+1;
dp[i][1]=dp[i-1][0]+1;
}
}
cout<<dp[N][P]<<endl;
}
| a.cc: In function 'int main()':
a.cc:21:7: error: 'dp' was not declared in this scope; did you mean 'dup'?
21 | dp[i][0]=dp[i-1][0]+1;
| ^~
| dup
a.cc:25:7: error: 'dp' was not declared in this scope; did you mean 'dup'?
25 | dp[i][0]=dp[i-1][1]+1;
| ^~
| dup
a.cc:29:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
29 | cout<<dp[N][P]<<endl;
| ^~
| dup
|
s989244247 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
long long cob(long long x, long long y){
long long tmp1 = 1;
for(int i = x; i > x - y; i++){
tmp1 *= i;
}
long long tmp2 = 1;
for(int i = 1; i < y + 1; i++){
tmp2 *= i;
}
return tmp1 / tmp2;
}
int main(){
long long n, p; cin >> n >> p;
vector<int> a(n);
long long x = 0;
for(int i = 0; i < n; i++){
long long tmp; cin >> tmp;
if(tmp % 2 == 1) x++;
}
long long y = n - x;
long long out = 0;
if(p == 0){
int i = 0;
while(i <= x){
out += cob(x, i);
i += 2;
}
}else{
int = 1;
while(i <= x){
out += cob(x, i);
i += 2;
}
}
long long out2 = 1;
for(int i = 0; i < y; i++){
out2 *= 2;
}
cout << out * out2;
} | a.cc: In function 'int main()':
a.cc:33:9: error: expected unqualified-id before '=' token
33 | int = 1;
| ^
a.cc:34:11: error: 'i' was not declared in this scope
34 | while(i <= x){
| ^
|
s487174718 | p03665 | C++ | #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include<string>
#include <stack>
#include<queue>
#include<map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;
int main() {
int n,p,ans=0;
bool gu=true;
cin>>n>>p;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a[i];
if(a[i]%2!=0) gu=false;
}
if(gu==true){
if(p==0){
cout << fixed << setprecision(15) <<pow(2,n) << endl;
}else if(p==1){
cout<<"0"<<endl;
}
}else{
cout << fixed << setprecision(15) << pow(2,n-1) << endl;
}
}
| a.cc: In function 'int main()':
a.cc:29:62: error: 'pow' was not declared in this scope
29 | cout << fixed << setprecision(15) <<pow(2,n) << endl;
| ^~~
a.cc:34:55: error: 'pow' was not declared in this scope
34 | cout << fixed << setprecision(15) << pow(2,n-1) << endl;
| ^~~
|
s668303119 | p03665 | C++ | #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include<Math.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include<string>
#include <stack>
#include<queue>
#include<map>
#include <stdlib.h>
#include <bits/stdc++.h>
#include <set>
typedef long long ll;
using namespace std;
int main() {
int n,p,ans=0;
bool gu=true;
cin>>n>>p;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a[i];
if(a[i]%2!=0) gu=false;
}
if(gu==true){
if(p==0){
cout << fixed << setprecision(15) <<pow(2,n) << endl;
}else if(p==1){
cout<<"0"<<endl;
}
}else{
cout << fixed << setprecision(15) << pow(2,n-1) << endl;
}
}
| a.cc:6:9: fatal error: Math.h: No such file or directory
6 | #include<Math.h>
| ^~~~~~~~
compilation terminated.
|
s302521429 | p03665 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x) (int)x.size()
#define SP(x) setprecision((int)x)
using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数
//-------------------------------------------------
//コピペするとこ
int conbi(int n,int k){
int a = 1 ;
REP(i,k){
a *=(n-k) ;
}
REP(i,k){
a /= (i+1) ;
}
return a ;
}
int jo(int n){
int a = 1;
REP(i,n){
a *= 2 ;
}
return a ;
}
//-------------------------------------------------
int main()
{
int n ;
cin >> n ;
int p ;
cin >> p ;
int ck = 0 ;
int cg = 0 ;
int ans = 1 ;
REP(i,n){
int a ;
cin >> a ;
if(a%2==0){
cg++ ;
}
else{
ck++ ;
}
}
if(p==0){
for(int i=0;i<=ck;i+=2){
ans *= combi(ck,i) ;
}
ans += jo(cg) ;
}
else{
for(int i=1;i<=ck;i+=2){
ans *= combi(ck,i) ;
}
ans *= jo(cg) ;
}
cout <<ans <<endl ;
return 0 ;
}
| a.cc: In function 'int main()':
a.cc:79:14: error: 'combi' was not declared in this scope; did you mean 'conbi'?
79 | ans *= combi(ck,i) ;
| ^~~~~
| conbi
a.cc:85:14: error: 'combi' was not declared in this scope; did you mean 'conbi'?
85 | ans *= combi(ck,i) ;
| ^~~~~
| conbi
|
s003986590 | p03665 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int P = sc.necrInt();
int odd = 0;
for (int i = 0; i < N; i ++) {
if (sc.nextInt()%2 == 1) odd++;
}
long oddComb = 0;
for (int i = 1; i <= odd; i+=2) {
oddComb += comb(odd, i);
}
System.out.println(p == 1
? oddComb : (1L<<N)-oddComb);
}
private static long comb(int a, int b) {
long numer = 1;
long denom = 1;
for (int i = 0; i < b; i++) {
numer *= a-i;
denom *= i+1;
}
return numer/denom;
}
} | Main.java:7: error: cannot find symbol
int P = sc.necrInt();
^
symbol: method necrInt()
location: variable sc of type Scanner
Main.java:18: error: cannot find symbol
System.out.println(p == 1
^
symbol: variable p
location: class Main
2 errors
|
s884733623 | p03665 | Java | import java.util.*;
public class Main {
pubkic static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int P = sc.necrInt();
int odd = 0;
for (int i = 0; i < N; i ++) {
if (sc.nextInt()%2 == 1) odd++;
}
long oddComb = 0;
for (int i = 1; i <= odd; i+=2) {
oddComb += comb(odd, i);
}
System.out.println(p == 1
? oddComb : (1L<<N)-oddComb;
}
private static long comb(int a, int b) {
long numer = 1;
long denom = 1;
for (int i = 0; i < b; i++) {
numer *= a-i;
denom *= i+1;
}
return numer/denom;
}
} | Main.java:4: error: <identifier> expected
pubkic static void main(String[] args) {
^
Main.java:19: error: ')' or ',' expected
? oddComb : (1L<<N)-oddComb;
^
2 errors
|
s148201050 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,p; cin>>n>>p;
int C[n+1][n+1];
long long c0=0,c1=0;
for(int i=0;i<n;i++){
int a; cin>>a;
if(a%2==0) c0++;
else c1++;
}C[0][0]=1;
for(int i=1;i<=n;i++){
for(int j=0;j<=i;j++){
if(j==0 || j==i) C[i][j]=1;
else C[i][j]=C[i-1][j-1]+C[i-1][j];
}
}
long long re=pow(2,c0) ans=0;
for(int bit=0;bit<=c1;bit++){
if(bit%2==p) ans+=re*C[n][bit];
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:19:26: error: expected ',' or ';' before 'ans'
19 | long long re=pow(2,c0) ans=0;
| ^~~
a.cc:21:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
21 | if(bit%2==p) ans+=re*C[n][bit];
| ^~~
| abs
a.cc:23:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
23 | cout<<ans<<endl;
| ^~~
| abs
|
s561263346 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
int main () {
int N, P, odd = 0, even = 0;
cin >> N >> P;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
if (A % 2) odd++;
else even++;
}
long long ans = 1;
if (even == N) {
for (int i = 0; i < N; i++) {
ans *= 2;
}
cout << ans << endl;
} else {
for (int i = 0; i < N-1; i++) {
ans *= 2;
}
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:11:13: error: no match for 'operator%' (operand types are 'std::vector<int>' and 'int')
11 | if (A % 2) odd++;
| ~ ^ ~
| | |
| | int
| std::vector<int>
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
from a.cc:1:
/usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed:
a.cc:11:15: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
11 | if (A % 2) odd++;
| ^
/usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed:
a.cc:11:15: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
11 | if (A % 2) odd++;
| ^
/usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed:
a.cc:11:15: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
11 | if (A % 2) odd++;
| ^
/usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed:
a.cc:11:15: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
11 | if (A % 2) odd++;
| ^
/usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed:
a.cc:11:15: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
11 | if (A % 2) odd++;
| ^
/usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const valarray<_Tp>&, const valarray<_Tp>&)'
1200 | _DEFINE_BINARY_OPERATOR(%, __modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed:
a.cc:11:15: note: 'std::vector<int>' is not derived from 'const std::valarray<_Tp>'
11 | if (A % 2) odd++;
| ^
/usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1200 | _DEFINE_BINARY_OPERATOR(%, __modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed:
a.cc:11:15: note: 'std::vector<int>' is not derived from 'const std::valarray<_Tp>'
11 | if (A % 2) odd++;
| ^
/usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1200 | _DEFINE_BINARY_OPERATOR(%, __modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed:
a.cc:11:15: note: mismatched types 'const std::valarray<_Tp>' and 'int'
11 | if (A % 2) odd++;
| ^
|
s249441456 | p03665 | C | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
ll MOD = (1e9)+7;
void fastIO(){
ios_base::sync_with_stdio(0); cin.tie(0);
}
int main(){
fastIO();
ll n,c,x;
cin>>n>>c;
int par=0,impar=0;
for(int i=0;i<n;i++){
cin>>x;
x%2==0?par++:impar++;
}
ll ans = 1;
if(impar){
for(int i=0;i<impar+par-1;i++){
ans*=2;
}
}else{
for(int i=0;i<n;i++){
ans*=2;
}
}
cout<<ans<<endl;
}
| main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s881473027 | p03665 | C++ | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
long long int64_t a,b,c[110],d[110],e,f,g[110],h[110];
cin >>a>>b;
e =0,f=0;
for(int i=0;i<a;i++)
cin >> c[i];
for(int i=0;i<a;i++){
d[i] = c[i]%2;
if( d[i] ==0){
e ++;
}
else{
f++;
}
}
g[0] =1,h[0]=1;
for(int i=0;i<e;i++){
g[i+1] =2*g[i];
}
for(int i=0;i<f-1;i++){
h[i+1] =2*h[i];
}
if(b ==1&&f==0){
cout <<"0" <<endl;
}
else if(f==0){
cout << g[e+1] << endl;
}
else{
cout << h[f-1]*g[e] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:5:21: error: expected initializer before 'a'
5 | long long int64_t a,b,c[110],d[110],e,f,g[110],h[110];
| ^
a.cc:6:9: error: 'a' was not declared in this scope
6 | cin >>a>>b;
| ^
a.cc:6:12: error: 'b' was not declared in this scope
6 | cin >>a>>b;
| ^
a.cc:7:4: error: 'e' was not declared in this scope
7 | e =0,f=0;
| ^
a.cc:7:9: error: 'f' was not declared in this scope
7 | e =0,f=0;
| ^
a.cc:9:12: error: 'c' was not declared in this scope
9 | cin >> c[i];
| ^
a.cc:13:4: error: 'd' was not declared in this scope
13 | d[i] = c[i]%2;
| ^
a.cc:13:11: error: 'c' was not declared in this scope
13 | d[i] = c[i]%2;
| ^
a.cc:22:3: error: 'g' was not declared in this scope
22 | g[0] =1,h[0]=1;
| ^
a.cc:22:11: error: 'h' was not declared in this scope
22 | g[0] =1,h[0]=1;
| ^
|
s460891586 | p03665 | C++ | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
long long int a,b,c[110],d[110],e,f,g[110],h[110];
cin >>a>>b;
e =0,f=0;
for(int i=0;i<a;i++)
cin >> c[i];
for(int i=0;i<a;i++){
d[i] = c[i]%2;
if( d[i] ==0){
e ++;
}
else{
f++;
}
}
g =1,h=1;
for(int i=0;i<e;i++){
g *=2;
}
for(int i=0;i<f-1;i++){
h*=2;
}
if(b ==1&&f==0){
cout <<"0" <<endl;
}
else if(f==0){
cout << g << endl;
}
else{
cout << f*g << endl;
}
}
| a.cc: In function 'int main()':
a.cc:22:5: error: incompatible types in assignment of 'int' to 'long long int [110]'
22 | g =1,h=1;
| ~~^~
a.cc:22:9: error: incompatible types in assignment of 'int' to 'long long int [110]'
22 | g =1,h=1;
| ~^~
a.cc:24:7: error: invalid operands of types 'long long int [110]' and 'int' to binary 'operator*'
24 | g *=2;
| ~~^~~
a.cc:24:7: note: in evaluation of 'operator*=(long long int [110], int)'
a.cc:27:6: error: invalid operands of types 'long long int [110]' and 'int' to binary 'operator*'
27 | h*=2;
| ~^~~
a.cc:27:6: note: in evaluation of 'operator*=(long long int [110], int)'
a.cc:39:14: error: invalid operands of types 'long long int' and 'long long int [110]' to binary 'operator*'
39 | cout << f*g << endl;
| ~^~
| | |
| | long long int [110]
| long long int
|
s997941633 | p03665 | C++ | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
long long int a,b,c[110],d[110],e,f,g[110],h[110];
e =0,f=0;
for(int i=0;i<a;i++)
cin >> c[i];
for(int i=0;i<a;i++){
d[i] = c[i]%2;
if( d[i] ==0){
e ++;
}
else{
f++;
}
}
g[0] =1,h[0]=1;
for(int i=0;i<e;i++){
g[i+1] =2*g[i];
}
for(int i=0;i<f-1;i++){
h[i+1] =2*[i];
}
if(b ==1&&f==0){
cout <<"0" <<endl;
return 0;
}
else{
cout << g[e]*h[f-1] << endl;
}
}
| a.cc: In lambda function:
a.cc:26:18: error: expected '{' before ';' token
26 | h[i+1] =2*[i];
| ^
a.cc: In function 'int main()':
a.cc:26:14: error: no match for 'operator*' (operand types are 'int' and 'main()::<lambda()>')
26 | h[i+1] =2*[i];
| ~^~~~
| | |
| | main()::<lambda()>
| int
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/complex:400:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const complex<_Tp>&)'
400 | operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:400:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::complex<_Tp>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/complex:409:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const _Tp&)'
409 | operator*(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:409:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::complex<_Tp>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/complex:418:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const _Tp&, const complex<_Tp>&)'
418 | operator*(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:418:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: 'main()::<lambda()>' is not derived from 'const std::complex<_Tp>'
26 | h[i+1] =2*[i];
| ^
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: 'main()::<lambda()>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: 'main()::<lambda()>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/valarray:1198:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__multiplies, _Tp>::result_type> std::operator*(const valarray<_Tp>&, const valarray<_Tp>&)'
1198 | _DEFINE_BINARY_OPERATOR(*, __multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1198:1: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::valarray<_Tp>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/valarray:1198:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__multiplies, _Tp>::result_type> std::operator*(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1198 | _DEFINE_BINARY_OPERATOR(*, __multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1198:1: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::valarray<_Tp>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/valarray:1198:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__multiplies, _Tp>::result_type> std::operator*(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1198 | _DEFINE_BINARY_OPERATOR(*, __multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1198:1: note: template argument deduction/substitution failed:
a.cc:26:18: note: 'main()::<lambda()>' is not derived from 'const std::valarray<_Tp>'
26 | h[i+1] =2*[i];
| ^
|
s812846979 | p03665 | C++ | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main() {
long long int a,b,c[110],d[110],e,f,g,h;
e =0,f=0;
for(int i=0;i<a;i++)
cin >> c[i];
for(int i=0;i<a;i++){
d[i] = c[i]%2;
if( d[i] ==0){
e ++;
}
else{
f++;
}
}
g[0] =1,h[0]=1;
for(int i=0;i<e;i++){
g[i+1] =2*g[i];
}
for(int i=0;i<f-1;i++){
h[i+1] =2*[i];
}
if(b ==1&&f==0){
cout <<"0" <<endl;
return 0;
}
else{
cout << g[e]*h[f-1] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:21:4: error: invalid types 'long long int[int]' for array subscript
21 | g[0] =1,h[0]=1;
| ^
a.cc:21:12: error: invalid types 'long long int[int]' for array subscript
21 | g[0] =1,h[0]=1;
| ^
a.cc:23:6: error: invalid types 'long long int[int]' for array subscript
23 | g[i+1] =2*g[i];
| ^
a.cc:23:16: error: invalid types 'long long int[int]' for array subscript
23 | g[i+1] =2*g[i];
| ^
a.cc:26:6: error: invalid types 'long long int[int]' for array subscript
26 | h[i+1] =2*[i];
| ^
a.cc: In lambda function:
a.cc:26:18: error: expected '{' before ';' token
26 | h[i+1] =2*[i];
| ^
a.cc: In function 'int main()':
a.cc:26:14: error: no match for 'operator*' (operand types are 'int' and 'main()::<lambda()>')
26 | h[i+1] =2*[i];
| ~^~~~
| | |
| | main()::<lambda()>
| int
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/complex:400:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const complex<_Tp>&)'
400 | operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:400:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::complex<_Tp>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/complex:409:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const _Tp&)'
409 | operator*(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:409:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::complex<_Tp>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/complex:418:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const _Tp&, const complex<_Tp>&)'
418 | operator*(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:418:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: 'main()::<lambda()>' is not derived from 'const std::complex<_Tp>'
26 | h[i+1] =2*[i];
| ^
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: 'main()::<lambda()>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed:
a.cc:26:18: note: 'main()::<lambda()>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/valarray:1198:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__multiplies, _Tp>::result_type> std::operator*(const valarray<_Tp>&, const valarray<_Tp>&)'
1198 | _DEFINE_BINARY_OPERATOR(*, __multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1198:1: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::valarray<_Tp>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/valarray:1198:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__multiplies, _Tp>::result_type> std::operator*(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1198 | _DEFINE_BINARY_OPERATOR(*, __multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1198:1: note: template argument deduction/substitution failed:
a.cc:26:18: note: mismatched types 'const std::valarray<_Tp>' and 'int'
26 | h[i+1] =2*[i];
| ^
/usr/include/c++/14/valarray:1198:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__multiplies, _Tp>::result_type> std::operator*(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1198 | _DEFINE_BINARY_OPERATOR(*, __multiplies)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1198:1: note: template argument deduction/substitution failed:
a.cc:26:18: note: 'main()::<lambda()>' is not derived from 'const std::valarray<_Tp>'
26 | h[i+1] =2*[i];
| ^
a.cc:34:14: error: invalid types 'long long int[long long int]' for array subscript
34 | cout << g[e]*h[f-1] << endl;
| ^
a.cc:34:19: error: invalid types 'long long int[long long int]' for array subscript
34 | cout << g[e]*h[f-1] << endl;
| ^
|
s612099686 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
const int maxn = 50 + 10;
long long int a[maxn];
long long int tavan(int a, int b)
{
long long int jav = 1;
int (int i = 0; i < b; i ++)
{
jav *= a;
}
return jav;
}
int main()
{
long long int n, k, e = 0, o = 0, jav = 0;
cin >> n >> k;
for (int i = 0; i < n; i ++)
{
cin >> a[i];
if (a[i] % 2 == 0)
e ++;
else
o ++;
}
jav *= (long long int) tavan(2, e);
jav *= (long long int) tavan(2, o - 1);
/*if (e == 0 && k == 1)
{
jav = pow(2, (o - 1));
}
else if (o == 0 && k == 0)
{
jav = pow (2, e);
}
else if (o == 0 && k == 1)
{
jav = 0;
}
else if (k == 1 || k == 0)
{
jav = pow (2, e) * pow(2, (o - 1));
}
*/
cout << jav;
return 0;
}
| a.cc: In function 'long long int tavan(int, int)':
a.cc:11:5: error: expected primary-expression before 'int'
11 | int (int i = 0; i < b; i ++)
| ^~~
a.cc:11:21: error: 'i' was not declared in this scope
11 | int (int i = 0; i < b; i ++)
| ^
|
s489438870 | p03665 | C++ | #include <iostream>
//using namespace std;long n,x,a,i,b;int main(){for(cin>>n>>x;n>i;i++){cin>>a;b+=a%2;}cout << (b?1<<n:x?0:1<<--n) << endl;} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s275831547 | p03665 | C++ | #include <iostream>
using namespace std;int main(){long long n,x;cin>>n>>x;for(int i = 0; n > i; i++){int a;cin>>a;if(a%2==1){cout << (long long)pow(2,n)/2 << endl;return 0;}}cout << (x==0?(long long)pow(2,n):0) << endl;} | a.cc: In function 'int main()':
a.cc:2:126: error: 'pow' was not declared in this scope
2 | using namespace std;int main(){long long n,x;cin>>n>>x;for(int i = 0; n > i; i++){int a;cin>>a;if(a%2==1){cout << (long long)pow(2,n)/2 << endl;return 0;}}cout << (x==0?(long long)pow(2,n):0) << endl;}
| ^~~
a.cc:2:181: error: 'pow' was not declared in this scope
2 | using namespace std;int main(){long long n,x;cin>>n>>x;for(int i = 0; n > i; i++){int a;cin>>a;if(a%2==1){cout << (long long)pow(2,n)/2 << endl;return 0;}}cout << (x==0?(long long)pow(2,n):0) << endl;}
| ^~~
|
s316020893 | p03665 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main(){
long long n,x;cin>>n>>x;
for(int i = 0; n > i; i++)int a;cin>>a;if(a%2==1){cout << (long long)pow(2,n)/2 << endl;return 0;}
cout << (x==0?(long long)pow(2,n):0) << endl;
}
| a.cc: In function 'int main()':
a.cc:6:40: error: 'a' was not declared in this scope
6 | for(int i = 0; n > i; i++)int a;cin>>a;if(a%2==1){cout << (long long)pow(2,n)/2 << endl;return 0;}
| ^
|
s173002710 | p03665 | C++ | N, P = map(int,input().split())
A = list(map(int,input().split()))
dp = [[[0 for k in range(2)] for j in range(N+1)] for i in range(N+1)] #dp[i][j][k]は1-iまででj個選んだ時にmod2がkとなる選び方
dp[1][0][0] = 1
if(A[0] % 2 == 0):
dp[1][1][0] = 1
else:
dp[1][1][1] = 1
for i in range(2, N+1):
for j in range(i+1):
if(j == 0):
dp[i][j][0] = 1
else:
if(A[i-1] % 2 == 0):
dp[i][j][0] = dp[i-1][j-1][0] + dp[i-1][j][0]
dp[i][j][1] = dp[i-1][j-1][1] + dp[i-1][j][1]
else:
dp[i][j][0] = dp[i-1][j-1][1] + dp[i-1][j][0]
dp[i][j][1] = dp[i-1][j-1][0] + dp[i-1][j][1]
ans = 0
if(P == 0):
for i in range(N+1):
ans += dp[N][i][0]
else:
for i in range(N+1):
ans += dp[N][i][1]
print(str(ans)) | a.cc:3:72: error: stray '#' in program
3 | dp = [[[0 for k in range(2)] for j in range(N+1)] for i in range(N+1)] #dp[i][j][k]は1-iまででj個選んだ時にmod2がkとなる選び方
| ^
a.cc:1:1: error: 'N' does not name a type
1 | N, P = map(int,input().split())
| ^
|
s473774816 | p03665 | C++ | #incluce<bits/stdc++.h>
using namespace std;
int main(){
int N, P;
cin >> N >> P;
for(int i=0; i<N; i++){
int A; cin >> A;
}
cout << (long long)pow(2, N-1) << endl;
return 0;
} | a.cc:1:2: error: invalid preprocessing directive #incluce; did you mean #include?
1 | #incluce<bits/stdc++.h>
| ^~~~~~~
| include
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin >> N >> P;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #incluce<bits/stdc++.h>
a.cc:10:3: error: 'cout' was not declared in this scope
10 | cout << (long long)pow(2, N-1) << endl;
| ^~~~
a.cc:10:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:22: error: 'pow' was not declared in this scope
10 | cout << (long long)pow(2, N-1) << endl;
| ^~~
a.cc:10:37: error: 'endl' was not declared in this scope
10 | cout << (long long)pow(2, N-1) << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #incluce<bits/stdc++.h>
|
s383219765 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<int,int>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
lli A,B,C,L,R,N,M,K,X=0,Y=0,W,H=INF,sum=0,num=0,flag=0;string S,T,O;
cin >> N >> K;
Vec(P,lli,N,0);rep(i,0,N)cin >> P[i];
rep(i,0,N)if(P[i]%2)flag=1;
if(!flag){
A=pow(2,N);
if(!K)Out(A);
else Out(0);
}
A=pow(2,N-1);
else Out(A);
} | a.cc: In function 'int main()':
a.cc:37:4: error: 'else' without a previous 'if'
37 | else Out(A);
| ^~~~
|
s092477829 | p03665 | C++ | #include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
const long long MOD = 1000000007;
typedef long long ll;
int
main(int argc, char *argv[])
{
int n, p, a, f = 0;
cin >> n >> p;
rep(i, n) {
cin >> a[i];
}
ll dp[60][3];
dp[0][0] = 1;
dp[0][1] = 0;
for (int i = 1; i <= n; i++) {
if (a[i] % 2) {
dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
dp[i][1] = dp[i][0];
} else {
dp[i][0] = (ll)2 * dp[i - 1][0];
dp[i][1] = dp[i][0];
}
}
cout << dp[n][p] << endl;
return 0;
}
| a.cc: In function 'int main(int, char**)':
a.cc:23:13: error: invalid types 'int[int]' for array subscript
23 | cin >> a[i];
| ^
a.cc:30:10: error: invalid types 'int[int]' for array subscript
30 | if (a[i] % 2) {
| ^
|
s687444918 | p03665 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
using namespace std;
typedef long long int ll;
int main(){
int n,p; cin >> n >> p;
vector<int> a(n);
int odd=0;
for(int i=0;i<n;i++){
cin >> a[i];
if(a[i]%2==1)odd++;
}
if(p==1&&odd==0){
cout << 0 << endl;
return 0;
}
ll ans;
else if(p==0&&odd==0){
ans=pow(2,n);
}
else{
ans=pow(2,n-1);
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:22:9: error: 'else' without a previous 'if'
22 | else if(p==0&&odd==0){
| ^~~~
|
s431057268 | p03665 | C++ | #include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
int n, m;
int a[2005];
long long ans;
int f[10005]={0};
int main(){
cin >> n >> p;
for (int i=1; i<=n; i++) cin >> a[i];
f[0]=1;
for (int i=1; i<=n; i++)
for (int j=5000; j>=a[i]; j--)
if (f[j-a[i]]>0) f[j]+=f[j-a[i]];
if (p%2==1){
for (int i=1; i<=4999; i+=2){
ans+=f[i];
}
}
else {
for (int i=0; i<=5000; i+=2){
ans+=f[i];
}
}
if (ans!=0) cout << ans << endl;
else return 0;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:17: error: 'p' was not declared in this scope
13 | cin >> n >> p;
| ^
|
s141129344 | p03665 | C++ | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author edamat
*/
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a), i##_len = (b); i < i##_len; ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _repr(i, n) repri(i, n, 0)
/* loop in [n,m] step -1 */
#define repri(i, a, b) for(int i = int(a), i##_len = (b); i >= i##_len; --i)
/* loop in [n,0] step -1 or [n,m] step -1 */
#define repr(...) _overload3(__VA_ARGS__, repri, _repr, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define pb push_back
#define eb emplace_back
#define endl '\n'
typedef long long lint;
#define int lint
const int INF = (int) (1 << 30) - 1;
int MOD = (int) 1e9 + 7;
//const double EPS = 1e-9;
const lint LINF = (lint) (1LL << 62) - 1;
typedef vector<int> vint;
typedef pair<int, int> pint;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
// cout << fixed << setprecision(20);
// cerr << fixed << setprecision(20);
}
} iosetup;
using std::to_string;
auto to_string(std::string s) -> std::string {
return '"' + s + '"';
}
auto to_string(char c) -> std::string {
return "'" + std::string{c} + "'";
}
auto to_string(const char *s) -> std::string {
return to_string((std::string) s);
}
auto to_string(bool b) -> std::string {
return (b?"true":"false");
}
template<typename T, typename U>
auto to_string(std::pair<T, U> p) -> std::string {
return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template<size_t N>
auto to_string(std::bitset<N> bs) -> std::string {
std::string res{};
for(size_t i = 0; i < N; i++)
res.insert(res.begin(), bs.test(i)?'1':'0');
return res;
}
template<typename T>
auto to_string(T v) -> std::string {
bool flg = false;
std::string res = "[";
for(auto const &x : v){
if(flg) res += ", ";
else flg = true;
res += to_string(x);
}
res += "]";
return res;
}
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define SZ(x) ((int)(x).size())
/* range macro. usage: for(int i:range(n)) */
class range {
private:
struct I {
int x;
int operator*() { return x; }
bool operator!=(I &lhs) { return x < lhs.x; }
void operator++() { ++x; }
};
I i, n;
public:
range(int n) : i({0}), n({n}) {}
range(int i, int n) : i({i}), n({n}) {}
I &begin() { return i; }
I &end() { return n; }
};
/* keep a max,min */
template<class T>
bool chmax(T &a, const T &b) {
if(a < b){
a = b;
return 1;
}
return 0;
}
template<class T>
bool chmin(T &a, const T &b) {
if(a > b){
a = b;
return 1;
}
return 0;
}
/* input,output operator for pair and vector */
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
os << p.first << " " << p.second;
return os;
}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
is >> p.first >> p.second;
return is;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
for(int i = 0; i < (int) v.size(); i++){
os << v[i] << (i + 1 != v.size()?" ":"");
}
return os;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
for(int i = 0; i < (int) v.size(); i++){
os << v[i] << (i + 1 != v.size()?"\n":"");
}
return os;
}
template<typename T>
istream &operator>>(istream &is, vector<T> &v) {
for(T &in : v) is >> in;
return is;
}
template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp) {
os << "{";
for(auto x = mp.begin(); x != mp.end(); ++x){
os << x->first << ":" << x->second
<< (x != prev(mp.end())?", ":"");
}
os << "}";
return os;
}
/* initialize vector. usage: auto v = male_v<int>(N,0); */
template<typename T>
vector<T> make_v(size_t a) {
return vector<T>(a);
}
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
/* fill vector. usage: fill_v(v,0); */
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
t = v;
}
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
for(auto &e : t) fill_v(e, v);
}
/* sum */
template<typename T>
lint sum(vector<T> &v) {
lint ret = 0;
for(auto x : v){
ret += x;
}
return ret;
}
double sum(vector<double> &v) {
double ret = 0;
for(auto x : v){
ret += x;
}
return ret;
}
template<typename T>
auto sum(const T &a) {
return a;
}
template<typename T, typename... A>
auto sum(const T &first, const A &... rest) {
return sum(first) + sum(rest...);
}
/* mod */
lint intpow(lint a, lint n, lint mod) {
lint res = 1;
while(n > 0){
if(n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
template<typename T>
T intpow(T a, lint n) {
T res = 1;
while(n > 0){
if(n & 1) res = res * a;
a = a * a;
n >>= 1;
}
return res;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while(b){
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if(u < 0) u += m;
return u;
}
/* print */
template<typename T>
void print(const T &first) {
cout << first << endl;
}
template<typename T, typename... A>
void print(const T &first, const A &... rest) {
cout << first << " ";
print(rest...);
}
template<typename... A>
void print(const A &... rest) {
print(rest...);
}
struct RandomNumberGenerator {
mt19937 mt;
RandomNumberGenerator() : mt(chrono::steady_clock::now().time_since_epoch().count()) {}
int operator()(int a, int b) { // [a, b)
uniform_int_distribution<int> dist(a, b - 1);
return dist(mt);
}
int operator()(int b) { // [0, b)
return (*this)(0, b);
}
};
template< typename Monoid, typename OperatorMonoid = Monoid >
struct LazySegmentTree {
using F = function< Monoid(Monoid, Monoid) >;
using G = function< Monoid(Monoid, OperatorMonoid, int) >;
using H = function< OperatorMonoid(OperatorMonoid, OperatorMonoid) >;
int sz;
vector< Monoid > data;
vector< OperatorMonoid > lazy;
const F f;
const G g;
const H h;
const Monoid M1;
const OperatorMonoid OM0;
LazySegmentTree(const F f, const G g, const H h,
const Monoid &M1, const OperatorMonoid OM0)
: f(f), g(g), h(h), M1(M1), OM0(OM0) {
}
void init(int n){
sz = 1;
while(sz < n) sz <<= 1;
data.assign(2 * sz, M1);
lazy.assign(2 * sz, OM0);
}
void set(int k, const Monoid &x) {
data[k + sz] = x;
}
void build() {
for(int k = sz - 1; k > 0; k--) {
data[k] = f(data[2 * k + 0], data[2 * k + 1]);
}
}
void propagate(int k, int len) {
if(lazy[k] != OM0) {
if(k < sz) {
lazy[2 * k + 0] = h(lazy[2 * k + 0], lazy[k]);
lazy[2 * k + 1] = h(lazy[2 * k + 1], lazy[k]);
}
data[k] = g(data[k], lazy[k], len);
lazy[k] = OM0;
}
}
Monoid update(int a, int b, const OperatorMonoid &x, int k, int l, int r) {
propagate(k, r - l);
if(r <= a || b <= l) {
return data[k];
} else if(a <= l && r <= b) {
lazy[k] = h(lazy[k], x);
propagate(k, r - l);
return data[k];
} else {
return data[k] = f(update(a, b, x, 2 * k + 0, l, (l + r) >> 1),
update(a, b, x, 2 * k + 1, (l + r) >> 1, r));
}
}
Monoid update(int a, int b, const OperatorMonoid &x) {
return update(a, b, x, 1, 0, sz);
}
Monoid query(int a, int b, int k, int l, int r) {
propagate(k, r - l);
if(r <= a || b <= l) {
return M1;
} else if(a <= l && r <= b) {
return data[k];
} else {
return f(query(a, b, 2 * k + 0, l, (l + r) >> 1),
query(a, b, 2 * k + 1, (l + r) >> 1, r));
}
}
Monoid query(int a, int b) {
return query(a, b, 1, 0, sz);
}
Monoid operator[](const int &k) {
return query(k, k + 1);
}
};
int main(){
int N;
cin >> N;
cout << intpow(2,N-1)<<endl;
}
| a.cc:25:13: error: '::main' must return 'int'
25 | #define int lint
| ^~~~
a.cc:386:1: note: in expansion of macro 'int'
386 | int main(){
| ^~~
|
s333775970 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long int n,p,e=0,a=1,b=0;cin>>n>>p;
for(int i=0;i<n;i++){
int a;cin>>a;
if(a%2)e++;
}
if(e>0){
for(int i=0;i<e;;i++)a*=2;
}
if(p==0){
for(int i=0;i<=n-e;i+=2){
long int c=1;
for(int j=n-e-i+1;j<=n-e;j++)c*=j;
for(int j=1;j<=i;j++)c/=j;
b+=c;
}
cout<<a*b<<endl;
}
else{
for(int i=1;i<=n-e;i+=2){
long int c=1;
for(int j=n-e-i+1;j<=n-e;j++)c*=j;
for(int j=1;j<=i;j++)c/=j;
b+=c;
}
cout<<a*b<<endl;
}
} | a.cc: In function 'int main()':
a.cc:10:21: error: expected primary-expression before ';' token
10 | for(int i=0;i<e;;i++)a*=2;
| ^
a.cc:10:21: error: expected ')' before ';' token
10 | for(int i=0;i<e;;i++)a*=2;
| ~ ^
| )
a.cc:10:22: error: 'i' was not declared in this scope
10 | for(int i=0;i<e;;i++)a*=2;
| ^
|
s205420117 | p03665 | C++ | #include<iostream>
using namespace std;
long i,n,p,a,f;
int main()
{
for(cin>>n>>p;i<n;i++)cin>>a,f+=a%2;
cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
} | a.cc: In function 'int main()':
a.cc:7:16: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'int')
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ~~~~~~~^~~
| | |
| | int
| std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}
a.cc:7:16: note: candidate: 'operator==(int, int)' (built-in)
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ~~~~~~~^~~
a.cc:7:16: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::fpos<_StateT>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::allocator<_CharT>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>'
7 | cout<<n==1&&f==0&&p==0?2:(!f)&&p?0:1l<<n-1)<<endl;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::tuple<_UTypes ...>'
7 | |
s783489175 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9 + 7;
const int INF = (int)100100100;
void comb(vector<vector <long long int> > &v){
for(int i = 0;i <v.size(); i++){
v[i][0]=1;
v[i][i]=1;
}
for(int k = 1;k <v.size();k++){
for(int j = 1;j<k;j++){
v[k][j]=(v[k-1][j-1]+v[k-1][j]);
}
}
}
int main() {
//ll N; cin >> N;
//ll N,M; cin >> N >> M;
//string S; cin >> S;
//ll H,W; cin >> H >> W;
ll N,P;
cin >> N >> P;
ll odd=0,even=0;
for(int i=0;i<N;i++){
int a;
cin >> a;
if(a%2==0)even++;
else odd++;
}
if (odd==0){
if(P==0){
ll ans=pow(2,N);
cout << ans;
}
else cout << 0 << endl;
}
ll ans=pow(2,N-1);
else cout << ans << endl;
}
/*
*/
| a.cc: In function 'int main()':
a.cc:41:5: error: 'else' without a previous 'if'
41 | else cout << ans << endl;
| ^~~~
|
s079101363 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll> ;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=1LL<<60;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用(EPSより小さいと0と判定など)
#define gcd __gcd //llは受け取ってくれない
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define ALL(a) a.begin(),a.end() //sort(ALL(vec));
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define PB push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに
//最大値、最小値を更新する。aよりbのが大きい(小さい)か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x);
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
// ----- template end ---- //
// ------- library ------- //
// ----- library end ----- //
int main() {
ll N, P;
cin >> N >> P;
vector<ll> As(N);
rep(i, N){
ll tmp;
cin >> tmp;
As.at(i) = tmp;
}
ll evens, odds;
evens = count_if(ALL(As), [](ll x) -> ll {return x % 2 == 0;}); //偶数なら数える
odds = N - evens;
// MODなしのnCk (DP→lambda式取出)
// n*nではなくパスカルの三角形分だけ確保することで、メモリをちょっと節約
ll n_limit = N; //!! nの最大値を設定 !!
vector<ll> CmbsVec( ( 2 + n_limit ) * ( 1 + n_limit ) / 2 );
//nCkへのアクセスは .at( ( n + 1 ) * n / 2 + k )
//n-1まで(1段上)の要素の総数が ( n + 1 ) * n / 2 なので、その次の段のk+1個目を0-indexed (つまり-1)に直すと、この式に
//nC0, nCnは全て1に
rep(i, n_limit+1){ //n : 0〜n_limitについて
CmbsVec.at( ( i + 1 ) * i / 2 + 0 ) = 1; //nC0
CmbsVec.at( ( i + 1 ) * i / 2 + i ) = 1; //nCn
}
//n C 1〜n-1を計算 nは2からスタート
REP(n, 2, n_limit + 1){ //nは2〜nまで全て
REP(k, 1, n_limit){ //kは1〜n-1
// nCk = n-1Ck-1 + n-1Ck
CmbsVec.at( ( n + 1 ) * n / 2 + k ) = CmbsVec.at( n * ( n - 1) / 2 + k - 1 ) + CmbsVec.at( n * ( n - 1 ) / 2 + k );
}
}
// nCkを返すlambda式を用意
ll Comb = [&] (ll n, ll k) -> ll {
return CmbsVec.at( ( n + 1 ) * n / 2 + k );
};
// cout << evens << ' ' << odds << endl;
ll ans = 0;
ll twoevens = pow(2, evens);
if (evens == 0){
twoevens = 1;
}
cout << twoevens << endl;
if (P==1 and odds!=0){ //奇数にしたい場合で、oddsがある場合(無ければ不可能)
//evensからいくつでも、oddsから奇数選ぶ
//for odds:1~N(gap2){oddsCi * 2^evens}
for (ll i=1; i <= N; i += 2){
ans += Comb(odds, i) * twoevens;
// cout << odds << ' ' << i << ' ' << comb(odds, i)<< endl;
}
} //奇数にしたい場合で、oddsが無い場合はans==0のままでOK
else if (P==0){ //偶数にしたい場合
//evensからいくつでも、oddsから偶数(0でもOK)選ぶ
//for odds:2~N(gap2){oddsCi * 2^evens}
for (ll i=0; i <= N; i += 2){
//combは(0, 0)の場合は1を返し、(0, 正)の場合は0を返す
ans += Comb(odds, i) * twoevens;
}
}
// cout << Comb(7, 3) << endl;
// cout << Comb(5, 1) << endl;
cout << ans << endl;
// -- main() end -- //
}
| a.cc: In function 'int main()':
a.cc:76:13: error: cannot convert 'main()::<lambda(ll, ll)>' to 'll' {aka 'long long int'} in initialization
76 | ll Comb = [&] (ll n, ll k) -> ll {
| ^~~~~~~~~~~~~~~~~~~~~~~~
| |
| main()::<lambda(ll, ll)>
77 | return CmbsVec.at( ( n + 1 ) * n / 2 + k );
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78 | };
| ~
a.cc:92:18: error: 'Comb' cannot be used as a function
92 | ans += Comb(odds, i) * twoevens;
| ~~~~^~~~~~~~~
a.cc:101:18: error: 'Comb' cannot be used as a function
101 | ans += Comb(odds, i) * twoevens;
| ~~~~^~~~~~~~~
|
s135133375 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll> ;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=1LL<<60;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用(EPSより小さいと0と判定など)
#define gcd __gcd //llは受け取ってくれない
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define ALL(a) a.begin(),a.end() //sort(ALL(vec));
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define PB push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに
//最大値、最小値を更新する。aよりbのが大きい(小さい)か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x);
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
// ----- template end ---- //
// ------- library ------- //
// ----- library end ----- //
int main() {
ll N, P;
cin >> N >> P;
vector<ll> As(N);
rep(i, N){
ll tmp;
cin >> tmp;
As.at(i) = tmp;
}
ll evens, odds;
evens = count_if(ALL(As), [](ll x) -> ll {return x % 2 == 0;}); //偶数なら数える
odds = N - evens;
// MODなしのnCk (DP→lambda式取出)
// n*nではなくパスカルの三角形分だけ確保することで、メモリをちょっと節約
ll n_limit = N; //!! nの最大値を設定 !!
vector<ll> CmbsVec( ( 2 + n_limit ) * ( 1 + n_limit ) / 2 );
//nCkへのアクセスは .at( ( n + 1 ) * n / 2 + k )
//n-1まで(1段上)の要素の総数が ( n + 1 ) * n / 2 なので、その次の段のk+1個目を0-indexed (つまり-1)に直すと、この式に
//nC0, nCnは全て1に
rep(i, n_limit+1){ //n : 0〜n_limitについて
CmbsVec.at( ( i + 1 ) * i / 2 + 0 ) = 1; //nC0
CmbsVec.at( ( i + 1 ) * i / 2 + i ) = 1; //nCn
}
//n C 1〜n-1を計算 nは2からスタート
REP(n, 2, n_limit + 1){ //nは2〜nまで全て
REP(k, 1, n_limit){ //kは1〜n-1
// nCk = n-1Ck-1 + n-1Ck
CmbsVec.at( ( n + 1 ) * n / 2 + k ) = CmbsVec.at( n * ( n - 1) / 2 + k - 1 ) + CmbsVec.at( n * ( n - 1 ) / 2 + k );
}
}
// nCkを返すlambda式を用意
ll Cmbs = [&] (ll n, ll k) -> ll {
return CmbsVec.at( ( n + 1 ) * n / 2 + k );
};
// cout << evens << ' ' << odds << endl;
ll ans = 0;
ll twoevens = pow(2, evens);
if (evens == 0){
twoevens = 1;
}
cout << twoevens << endl;
if (P==1 and odds!=0){ //奇数にしたい場合で、oddsがある場合(無ければ不可能)
//evensからいくつでも、oddsから奇数選ぶ
//for odds:1~N(gap2){oddsCi * 2^evens}
for (ll i=1; i <= N; i += 2){
ans += Cmbs(odds, i) * twoevens;
// cout << odds << ' ' << i << ' ' << comb(odds, i)<< endl;
}
} //奇数にしたい場合で、oddsが無い場合はans==0のままでOK
else if (P==0){ //偶数にしたい場合
//evensからいくつでも、oddsから偶数(0でもOK)選ぶ
//for odds:2~N(gap2){oddsCi * 2^evens}
for (ll i=0; i <= N; i += 2){
//combは(0, 0)の場合は1を返し、(0, 正)の場合は0を返す
ans += Combs(odds, i) * twoevens;
}
}
// cout << comb(7, 3) << endl;
// cout << comb(5, 1) << endl;
cout << ans << endl;
// -- main() end -- //
}
| a.cc: In function 'int main()':
a.cc:76:13: error: cannot convert 'main()::<lambda(ll, ll)>' to 'll' {aka 'long long int'} in initialization
76 | ll Cmbs = [&] (ll n, ll k) -> ll {
| ^~~~~~~~~~~~~~~~~~~~~~~~
| |
| main()::<lambda(ll, ll)>
77 | return CmbsVec.at( ( n + 1 ) * n / 2 + k );
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78 | };
| ~
a.cc:92:18: error: 'Cmbs' cannot be used as a function
92 | ans += Cmbs(odds, i) * twoevens;
| ~~~~^~~~~~~~~
a.cc:101:14: error: 'Combs' was not declared in this scope; did you mean 'Cmbs'?
101 | ans += Combs(odds, i) * twoevens;
| ^~~~~
| Cmbs
|
s607707642 | p03665 | C++ | 45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
| a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 45 1
| ^~
|
s965946045 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) VL (vec)(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t make_tuple
#define eb emplace_back
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define cont const auto
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
#define PQ priority_queue
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
void comb(V<VL>&n){
rep(i,SZ(n)){
n[i][0]=1;
n[i][i]=1;
}
reps(i,SZ(n)-1)
reps(j,i-1)
n[i][j]=n[i-1][j-1]+n[i-1][j];
}
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,p;
cin>>n>>p;
vector<long> a(n);
rep(i,n)cin>>a[i];
int even=0,odd=0;
for(auto e:a)(e&1?odd:even)++;
if(odd==0){
if(p==0)out(pow(2,n));
else out(0);
}
else{
out(pow(2,n-1));
}
return 0;
}
// WA
/* | a.cc:87:1: error: unterminated comment
87 | /*
| ^
|
s328107144 | p03665 | C | #include <stdio.h>
int main(void) {
int N, P, A[55], i, n_e, n_o;
long long c;
scanf("%d %d", &N, &P);
n_e=0; n_o=0;
for (i=1; i<=N; i++) {
scanf("%d", &A[i]);
if ((A[i])%2 == 0) n_e+=1;
else n_o+=1;
}
if (n_o!=0) {
c=1;
for (i=1; i<=N-1; i++) {
c*=2;
}
else if (P==1) c=0;
else {
c=1;
for (i=1; i<=N; i++) {
c*=2;
}
printf("%lld\n", c);
return 0;
} | main.c: In function 'main':
main.c:18:5: error: expected '}' before 'else'
18 | else if (P==1) c=0;
| ^~~~
main.c:26:1: error: expected declaration or statement at end of input
26 | }
| ^
|
s449195041 | p03665 | C++ | long long int N,P;
cin>>N>>P;
long long int A[N];
long long int S = 0,s=0,B=0;
for(int x = 0;x<N;x++){
cin>>A[x];
}for(int x = 0;x<N;x++){
if(A[x]%2==0){
S++;
}else{
s++;
}
}
if(P==0){
B+=1;
long long int D=0,C = S*(S+1)/2;
for(int x = s-1;x>0;x-=2){
D+=x;
}
B+=C+D;
}if(P==1){
for(int x = s;x>0;x-=2){
B+=x;
}
}
cout<<B<<"\n";
} | a.cc:2:1: error: 'cin' does not name a type
2 | cin>>N>>P;
| ^~~
a.cc:3:17: error: size of array 'A' is not an integral constant-expression
3 | long long int A[N];
| ^
a.cc:6:1: error: expected unqualified-id before 'for'
6 | for(int x = 0;x<N;x++){
| ^~~
a.cc:6:15: error: 'x' does not name a type
6 | for(int x = 0;x<N;x++){
| ^
a.cc:6:19: error: 'x' does not name a type
6 | for(int x = 0;x<N;x++){
| ^
a.cc:8:2: error: expected unqualified-id before 'for'
8 | }for(int x = 0;x<N;x++){
| ^~~
a.cc:8:16: error: 'x' does not name a type
8 | }for(int x = 0;x<N;x++){
| ^
a.cc:8:20: error: 'x' does not name a type
8 | }for(int x = 0;x<N;x++){
| ^
a.cc:15:1: error: expected unqualified-id before 'if'
15 | if(P==0){
| ^~
a.cc:22:2: error: expected unqualified-id before 'if'
22 | }if(P==1){
| ^~
a.cc:27:1: error: 'cout' does not name a type
27 | cout<<B<<"\n";
| ^~~~
a.cc:28:1: error: expected declaration before '}' token
28 | }
| ^
|
s378591990 | p03665 | C++ | long long int N,P;
cin>>N>>P;
long long int A[N];
long long int S = 0,s=0,B=0;
for(int x = 0;x<N;x++){
cin>>A[x];
}for(int x = 0;x<N;x++){
if(A[x]%2==0){
S++;
}else{
s++;
}
}
if(P==0){
B+=1;
long long int D=0,C = S*(S+1)/2;
for(int x = s-1;x>0;x-=2){
D+=x;
}
B+=C+D;
}if(P==1){
for(int x = s;x>0;x-=2){
B+=x;
}
}
cout<<B<<"\n"; | a.cc:2:1: error: 'cin' does not name a type
2 | cin>>N>>P;
| ^~~
a.cc:3:17: error: size of array 'A' is not an integral constant-expression
3 | long long int A[N];
| ^
a.cc:6:1: error: expected unqualified-id before 'for'
6 | for(int x = 0;x<N;x++){
| ^~~
a.cc:6:15: error: 'x' does not name a type
6 | for(int x = 0;x<N;x++){
| ^
a.cc:6:19: error: 'x' does not name a type
6 | for(int x = 0;x<N;x++){
| ^
a.cc:8:2: error: expected unqualified-id before 'for'
8 | }for(int x = 0;x<N;x++){
| ^~~
a.cc:8:16: error: 'x' does not name a type
8 | }for(int x = 0;x<N;x++){
| ^
a.cc:8:20: error: 'x' does not name a type
8 | }for(int x = 0;x<N;x++){
| ^
a.cc:15:1: error: expected unqualified-id before 'if'
15 | if(P==0){
| ^~
a.cc:22:2: error: expected unqualified-id before 'if'
22 | }if(P==1){
| ^~
a.cc:27:1: error: 'cout' does not name a type
27 | cout<<B<<"\n";
| ^~~~
|
s077542657 | p03665 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<string>
using namespace std;
const int INF = 1<<30;
typedef long long int ll;
int main(){
int n, p;cin>>n>>p;
int m=0;
for(int i=0;i<n;i++){
int t;cin>>t;
m+=(t%2!=0);
}
if(m==0) cout<<(p==0?(int)pow((float)2, n):0)<<endl;
else cout<<ll(pow((float)2, m-1)*pow((float)2, n-m))<<endl; | a.cc: In function 'int main()':
a.cc:21:68: error: expected '}' at end of input
21 | else cout<<ll(pow((float)2, m-1)*pow((float)2, n-m))<<endl;
| ^
a.cc:13:11: note: to match this '{'
13 | int main(){
| ^
|
s679015419 | p03665 | C++ | #include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
int main(){
ll n,q;
cin >> n >> q;
ll a[n];
for(int i=0;i<n;i++) cin >> a[i];
ll x=0,y=0;
for(int i=0;i<n;i++){
if(a[i]%2==0){
x++;
}
else{
y++;
}
}
if(y!=0){
cout << (ll)pow(2,n-1) << endl;
}
else{
if(p==0){
cout << (ll)pow(2,n) << endl;
}
else{
cout << 0 << endl;
}
}
}
| a.cc: In function 'int main()':
a.cc:25:8: error: 'p' was not declared in this scope
25 | if(p==0){
| ^
|
s038546749 | p03665 | C++ | #include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
int main(){
ll n,q;
cin >> n >> q;
for(int i=0;i<n;i++) cin >> a[i];
ll x=0,y=0;
for(int i=0;i<n;i++){
if(a[i]%2==0){
x++;
}
else{
y++;
}
}
if(y!=0){
cout << (ll)pow(2,n-1) << endl;
}
else{
if(p==0){
cout << (ll)pow(2,n) << endl;
}
else{
cout << 0 << endl;
}
}
}
| a.cc: In function 'int main()':
a.cc:10:31: error: 'a' was not declared in this scope
10 | for(int i=0;i<n;i++) cin >> a[i];
| ^
a.cc:13:8: error: 'a' was not declared in this scope
13 | if(a[i]%2==0){
| ^
a.cc:24:8: error: 'p' was not declared in this scope
24 | if(p==0){
| ^
|
s890172948 | p03665 | C++ | #include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;
int64 power2(int n){
int64 ans=1;
rep(i,n){
ans*=2;
}
return ans;
}
int main(){
int n,p,a=0,b=0;
cin>>n>>p;
int a[n];
rep(i,n){
cin>>a[i];
if(a[i]%2!=0){
a++;
}else{
b++;
}
}
if(a==0){
if(p==0){
cout<<power2(n);
}else{
cout<<0;
}
}else{
cout<<power2(n-1);
}
} | a.cc: In function 'int main()':
a.cc:25:7: error: conflicting declaration 'int a [n]'
25 | int a[n];
| ^
a.cc:23:11: note: previous declaration as 'int a'
23 | int n,p,a=0,b=0;
| ^
a.cc:27:11: error: invalid types 'int[int]' for array subscript
27 | cin>>a[i];
| ^
a.cc:28:9: error: invalid types 'int[int]' for array subscript
28 | if(a[i]%2!=0){
| ^
|
s553144520 | p03665 | C | #include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;
long long cmb(int a, int b){
long long s=1;
for(int i=1;i<=b;i++){
s=s*(a+1-i)/i;
}
return s;
}
int main(){
int n, p;
cin >> n >> p;
vector<int> m(2,0);
int a,i;
for(i=0;i<n;i++){
cin >> a;
m[a%2]++;
}
long long ans=(long long)exp2(m[0]),t=0;
for(i=p;i<=m[1];i+=2){
t+=cmb(m[1],i);
}
ans*=t;
cout << ans << endl;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s972732756 | p03665 | C++ | #include<iostream>
using namespace std;
long long n,p,ans=1,a,cnt0,cnt1;
main(){
cin>>n>>p;
for(int i=0;i<n;i++){
cin>>a;
ans*=2;
if(a%2)cnt1++;
else cnt0++;
}
if(cnt0==n and p==0)cout<<ans<<endl;
else if(cnt==n and p==1)cout<<0<<endl;
else cout<<ans/2<<endl;
} | a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:13:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
13 | else if(cnt==n and p==1)cout<<0<<endl;
| ^~~
| int
|
s017511832 | p03665 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<cstdio>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int SIZE = 100;
int main() {
ll n, p;
ll odd, even;
odd = even = 0;
scanf("%lld %lld", &n, &p);
vector<ll> a(n);
for (ll i = 0; i < n; i++) {
scanf("%lld", &a[i]);
if (a[i] % 2 == 0) {
even++;
}
else {
odd++;
}
}
if (p == 0) {
if (odd == 0) {
printf("%lld\n", (ll)pow(2, n));
return 0;
}
else {
printf("%lld\n", (ll)pow(2, n - 1));
return 0;
}
}
else {
if (odd >= 1) {
printf("%lld\n", (ll)pow(2, n - 1));
return 0;
}
else {
printf("%lld\n", (ll)0);
return 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:37:46: error: 'pow' was not declared in this scope
37 | printf("%lld\n", (ll)pow(2, n));
| ^~~
a.cc:41:46: error: 'pow' was not declared in this scope
41 | printf("%lld\n", (ll)pow(2, n - 1));
| ^~~
a.cc:47:46: error: 'pow' was not declared in this scope
47 | printf("%lld\n", (ll)pow(2, n - 1));
| ^~~
|
s577840999 | p03665 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<cstdio>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int SIZE = 100;
int main() {
ll n, p;
ll odd, even;
odd = even = 0;
scanf_s("%lld %lld", &n, &p);
vector<ll> a(n);
for (ll i = 0; i < n; i++) {
scanf_s("%lld", &a[i]);
if (a[i] % 2 == 0) {
even++;
}
else {
odd++;
}
}
if (p == 0) {
if (odd == 0) {
printf("%lld\n", (ll)pow(2, n));
return 0;
}
else {
printf("%lld\n", (ll)pow(2, n - 1));
return 0;
}
}
else {
if (odd >= 1) {
printf("%lld\n", (ll)pow(2, n - 1));
return 0;
}
else {
printf("%lld\n", (ll)0);
return 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
23 | scanf_s("%lld %lld", &n, &p);
| ^~~~~~~
| scanf
a.cc:37:46: error: 'pow' was not declared in this scope
37 | printf("%lld\n", (ll)pow(2, n));
| ^~~
a.cc:41:46: error: 'pow' was not declared in this scope
41 | printf("%lld\n", (ll)pow(2, n - 1));
| ^~~
a.cc:47:46: error: 'pow' was not declared in this scope
47 | printf("%lld\n", (ll)pow(2, n - 1));
| ^~~
|
s358577466 | p03665 | C++ | #include<bits/stdc++.h>
#include<math.h>
using namespace std;
typedef long long ll;
int main()
{
int N, P; cin >> N >> P;
ll ans = 1;
vector<int> A(N);
for(int i = 0; i < N; i++)
{
cin >> A.at(i);
}
int X = 0, Y = 0;
for(int i = 0; i < N; i++)
{
if(A.at(i) % 2 == 0)
{
X++; //A中の偶数袋の個数
}
else
{
Y++; //A中の奇数袋の個数
}
}
ll ans = 1;
for(int i = 0; i < N-1; i++)
{
ans *= 2;
}
if(X == N && P == 0)
{
cout << 2*ans <<endl;
}
else if(X == N && P == 1)
{
cout << 0 << endl;
}
else
{
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:8: error: redeclaration of 'll ans'
26 | ll ans = 1;
| ^~~
a.cc:8:8: note: 'll ans' previously declared here
8 | ll ans = 1;
| ^~~
|
s045807620 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,p;
cin >> n >> p;
bool gusu==true;
int a[n];
for (int i=0;i<n;i++){
cin >> a[i];
if (a[i]%2==1)gusu=false;
}
if (p==0 && gusu)cout << pow(2,n) <<endl;
else if (p==1 && gusu) cout << 0 <<endl;
else cout <<pow(2,n-1)<<endl;
} | a.cc: In function 'int main()':
a.cc:6:12: error: expected initializer before '==' token
6 | bool gusu==true;
| ^~
a.cc:10:19: error: 'gusu' was not declared in this scope
10 | if (a[i]%2==1)gusu=false;
| ^~~~
a.cc:12:15: error: 'gusu' was not declared in this scope
12 | if (p==0 && gusu)cout << pow(2,n) <<endl;
| ^~~~
|
s821969972 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,p;
scanf("%d %d", &n,&p);
int k0=0,k1=0;
for(int i=0;i<n;i++){
int a;
scanf("%d", &a);
if(a%2==0){
k0++;
}else{
k1++;
}
}
ll ans;
if(k1==0){
ans=(1LL<<n);
}else{
ans=(1LL<<(n-1));
}
if(p==1){
ans=(aLL<<n)-ans;
}
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:3: error: 'll' was not declared in this scope
18 | ll ans;
| ^~
a.cc:20:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
20 | ans=(1LL<<n);
| ^~~
| abs
a.cc:22:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
22 | ans=(1LL<<(n-1));
| ^~~
| abs
a.cc:25:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
25 | ans=(aLL<<n)-ans;
| ^~~
| abs
a.cc:25:10: error: 'aLL' was not declared in this scope
25 | ans=(aLL<<n)-ans;
| ^~~
a.cc:27:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
27 | cout<<ans<<endl;
| ^~~
| abs
|
s483208603 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
int n, p; cin >> n >> p;
int A[n];
for (int i = 0; i < n; i++) {
cin >> A[i];
}
int cnt_even = 0, cnt_odd = 0;
for (int i = 0; i < n; i++) {
if (A[i] % 2 == 0) cnt_even++;
else cnt_odd++;
}
long long ans = 0;
if (cnt_odd == 0) {
if (p == 0) cout << pow(2, n) << endl;
else cout << 0 << endl;
}
else {
cout << pow(2, N - 1) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:32: error: 'N' was not declared in this scope
20 | cout << pow(2, N - 1) << endl;
| ^
|
s903555052 | p03665 | C++ | #include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
const static long long int MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};
template<typename T> T combination(T n, T r)
{
if (r == 0 || r == n)
return (1);
else if (r == 1)
return (n);
return (combination(n - 1, r - 1) + combination(n - 1, r));
}
int main(int argc, char *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
int n, p, a, even = 0, odd = 0;
cin >> n >> p;
rep(i, n) {
cin >> a;
if (a % 2) ++odd;
else ++even;
}
llong ans = 0;
rep(i, odd + 1) {
if (p) {
if (i % 2) ans += combination(odd, i);
} else {
if (!(i % 2)) ans += combination(odd, i);
}
}
ans *= pow(2, even)
cout << ans << endl;
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:40:24: error: expected ';' before 'cout'
40 | ans *= pow(2, even)
| ^
| ;
41 |
42 | cout << ans << endl;
| ~~~~
|
s034140550 | p03665 | C++ | #include "bits/stdc++.h"
using namespace std;
int main() {
int N, P;
cin >> N >> P;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
int cnt0 = 0;
int cnt1 = 0;
for (int i = 0; i < N; i++) {
if (A[i] % 2 == 0) {
cnt0++;
}
else {
cnt1++;
}
}
if (P == 1 && cnt1 == 0) {
cout << 0 << endl;
}
else if (cnt0 == N && P == 0) {
long long ans = pow(2. N);
cout << ans << endl;
}
else {
long long ans = pow(2, N - 1);
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:27:31: error: expected ')' before 'N'
27 | long long ans = pow(2. N);
| ~ ^~
| )
a.cc:27:28: error: no matching function for call to 'pow(double)'
27 | long long ans = pow(2. N);
| ~~~^~~~~
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
from a.cc:1:
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Constant, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_Constant, _Tp, _Tp>, _Tp> std::pow(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const valarray<_Tp>&, const valarray<_Tp>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const valarray<typename _Dom::valarray>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::_Pow, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename _Dom1::value_type> std::pow(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
549 | _DEFINE_EXPR_BINARY_FUNCTION(pow, struct std::_Pow)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:549:1: note: candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:2482:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const complex<_Tp>&, const complex<_Up>&)'
2482 | pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
| ^~~
/usr/include/c++/14/complex:2482:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:2474:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const _Tp&, const complex<_Up>&)'
2474 | pow(const _Tp& __x, const std::complex<_Up>& __y)
| ^~~
/usr/include/c++/14/complex:2474:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:2466:5: note: candidate: 'template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote<decltype (((typename __gnu_cxx::__promote<_Tp, std::__is_integer<_Tp>::__value>::__type)(0) + (typename __gnu_cxx::__promote<_Up, std::__is_integer<_Up>::__value>::__type)(0)))>::__type> std::pow(const complex<_Tp>&, const _Up&)'
2466 | pow(const std::complex<_Tp>& __x, const _Up& __y)
| ^~~
/usr/include/c++/14/complex:2466:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:1339:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const _Tp&, const complex<_Tp>&)'
1339 | pow(const _Tp& __x, const complex<_Tp>& __y)
| ^~~
/usr/include/c++/14/complex:1339:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:1328:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, const complex<_Tp>&)'
1328 | pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~
/usr/include/c++/14/complex:1328:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:1294:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, const _Tp&)'
1294 | pow(const complex<_Tp>& __x, const _Tp& __y)
| ^~~
/usr/include/c++/14/complex:1294:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/complex:1285:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::pow(const complex<_Tp>&, int)'
1285 | pow(const complex<_Tp>& __z, int __n)
| ^~~
/usr/include/c++/14/complex:1285:5: note: candidate expects 2 arguments, 1 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:114:
/usr/include/c++/14/cmath:1074:5: note: candidate: 'template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)'
1074 | pow(_Tp __x, _Up __y)
| ^~~
/usr/include/c++/14/cmath:1074:5: note: candidate expects 2 arguments, 1 provided
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate: 'double pow(double, double)'
173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
| ^~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/cmath:380:3: note: candidate: 'constexpr long double std::pow(long double, long double)'
380 | pow(long double __x, long double __y)
| ^~~
/usr/include/c++/14/cmath:380:3: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/cmath:376:3: note: candidate: 'constexpr float std::pow(float, float)'
376 | pow(float __x, float __y)
| ^~~
/usr/include/c++/14/cmath:376:3: note: candidate expects 2 arguments, 1 provided
|
s793002426 | p03665 | C++ | #include <iostream>
#include <math.h>
#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++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
//static const ll MOD = 1;
static const ll MAX_L = (ll)1 << 62;
static const ll FACT_SIZE = 1000000;
int main() {
ll n, p; cin >> n >> p;
ll o = 0, e = 0;
rep(i, 0, n) {
ll a; cin >> a;
if (a & 1) o++;
else e++;
}
ll p = 0;
if (o == 0) {
if (p == 1) cout << 0 << endl;
else p = e;
}
else p = o + e - 1;
ll ans = 1;
rep(i, 0, p) {
ans *= 2;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:28:12: error: redeclaration of 'll p'
28 | ll p = 0;
| ^
a.cc:20:15: note: 'll p' previously declared here
20 | ll n, p; cin >> n >> p;
| ^
|
s876752048 | p03665 | C++ | /* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>
// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
/* ---------- Namespace ---------- */
using namespace std;
/* ---------- Type Abbreviation ---------- */
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;
using ll = long long;
#define fst first
#define snd second
#define mp make_pair
#define mt make_tuple
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
/* ---------- conversion ---------- */
#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)
#define DOUBLE(n) static_cast<double>(n)
/* ---------- container ---------- */
#define ALL(v) (v).begin(), (v).end()
#define SIZE(v) (LL((v).size()))
#define FIND(v, k) (v).find(k) != (v).end()
#define VFIND(v, k) find(ALL(v), k) != (v).end()
#define gsort(b, e) sort(b, e, greater<decltype(*b)>())
/* ----------- debug ---------- */
template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
os << "[";
for (auto vv : v)
os << vv << ",";
return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> v) {
os << "[";
for (auto vv : v)
os << vv << ",";
return os << "]";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
return os << "(" << p.fst << "," << p.snd << ")";
}
/* ---------- Constants ---------- */
// const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));
/* ---------- Short Functions ---------- */
template <typename T>
T sq(T a) {
return a * a;
}
template <typename T>
T gcd(T a, T b) {
if (a > b) return gcd(b, a);
return a == 0 ? b : gcd(b % a, a);
}
template <typename T, typename U>
T mypow(T b, U n) {
if (n == 0) return 1;
if (n == 1) return b /* % MOD */;
if (n % 2 == 0) {
return mypow(b * b /* % MOD */, n / 2);
}
else {
return mypow(b, n - 1) * b /* % MOD */;
}
}
ll pcnt(ll b) {
return __builtin_popcountll(b);
}
// const ll dx[4] = {0, -1, 1, 0};
// const ll dy[4] = {-1, 0, 0, 1};
// const ll dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const ll dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, P;
cin >> N >> P;
int A[N];
REP(i, N) {
cin >> A[i];
}
int odd = 0, even = 0;
REP(i, N) {
if (A[i] % 2 == 0) even++;
else odd++;
}
if (even == N) {
if (P == 0) {
cout << mypow(2, N) << endl;
return 0;
}
else {
cout << 0 < endl;
return 0;
}
}
else {
cout << mypow(2, N - 1) << endl;
return 0;
}
} | a.cc: In function 'int main()':
a.cc:156:35: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
156 | cout << 0 < endl;
| ~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/istream:40,
from /usr/include/c++/14/fstream:40,
from a.cc:5:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
156 | cout << 0 < endl;
| ^~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
156 | cout << 0 < endl;
| ^~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
156 | cout << 0 < endl;
| ^~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
156 | cout << 0 < endl;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
156 | cout << 0 < endl;
| ^~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
156 | cout << 0 < endl;
| ^~~~
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
156 | cout << 0 < endl;
| ^~~~
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: couldn't deduce template parameter '_CharT'
156 | cout << 0 < endl;
| ^~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
156 | cout << 0 < endl;
| ^~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
156 | cout << 0 < endl;
| ^~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3901 | operator<(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>'
156 | cout << 0 < endl;
| ^~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2600 | operator<(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>'
156 | cout << 0 < endl;
| ^~~~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/bits/random.h:34,
from /usr/include/c++/14/random:48,
from a.cc:14:
/usr/include/c++/14/bits/stl_vector.h:2089:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2089 | operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2089:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::vector<_Tp, _Alloc>'
156 | cout << 0 < endl;
| ^~~~
In file included from a.cc:17:
/usr/include/c++/14/array:339:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> bool std::operator<(const array<_Tp, _Nm>&, const array<_Tp, _Nm>&)'
339 | operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
| ^~~~~~~~
/usr/include/c++/14/array:339:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::array<_Tp, _Nm>'
156 | cout << 0 < endl;
| ^~~~
In file included from /usr/include/c++/14/deque:66,
from a.cc:19:
/usr/include/c++/14/bits/stl_deque.h:2334:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2334 | operator<(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2334:5: note: template argument deduction/substitution failed:
a.cc:156:37: note: 'std::basic_ostream<char>' is not derived from 'const std::deque<_Tp, _Alloc>'
156 | cout << 0 < endl;
| ^~~~
In file included from /usr/include/c++/14/ma |
s029403433 | p03665 | C++ | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
def main():
N, P = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x: x % 2, A))
if A.count(1):
ans = pow(2,N-1)
else:
if P == 0:
ans = pow(2,N)
else:
ans = pow(2,N-1)
print(ans)
if __name__ == '__main__':
main()
| a.cc:1:3: error: invalid preprocessing directive #-
1 | # -*- coding: utf-8 -*-
| ^
a.cc:20:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
20 | if __name__ == '__main__':
| ^~~~~~~~~~
a.cc:2:1: error: 'import' does not name a type
2 | import sys
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
|
s646405008 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
const int MAX=510000;
const int MOD=1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
fac[0]=fac[1]=1;
finv[0]=finv[1]=1;
inv[1]=1;
for (int i=2;i<MAX;i++) {
fac[i]=fac[i-1]*i%MOD;
inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
finv[i]=finv[i-1]*inv[i]%MOD;
}
}
long long COM(int n,int k) {
if (n<k) return 0;
if (n<0 || k<0) return 0;
return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
int main(){
COMinit();
int n,p,o=0,e=0;
long long ans=0;
scanf("%d %d",&n,&p);
vector<int> a(n);
for (auto&e:a) scanf("%d",&e);
for (int i=0;i<n;i++) if (a[i]%2) o++;
e=n-o;
int even[e];
int odd[o];
for (int i=0;i<e;i++) even[i]=COM(e,i);
for (int i=0;i<o;i++) odd[i]=COM(o,i);
if (p==0) {
if (e==0 || o==0) {
ans++;
} else {
ans+=2;
}
if (e>0){
for (int i=0;i<o;i++) {
for (int j=0;j<e;j++) {
ans+=odd[i]*even[j];
}
i++;
}
} else {
for (int i=0;i<o;i++) {
ans+=odd[i];
i++;
}
}
} else {
for (int i=1;i<o;i++) {
ans+=odd[i];
i++;
}
}
printf("%d\n",ans);
return 0;
}
#include<bits/stdc++.h>
using namespace std;
const int MAX=510000;
const int MOD=1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
fac[0]=fac[1]=1;
finv[0]=finv[1]=1;
inv[1]=1;
for (int i=2;i<MAX;i++) {
fac[i]=fac[i-1]*i%MOD;
inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
finv[i]=finv[i-1]*inv[i]%MOD;
}
}
long long COM(int n,int k) {
if (n<k) return 0;
if (n<0 || k<0) return 0;
return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
int main(){
COMinit();
int n,p,o=0,e=0;
long long ans=0;
scanf("%d %d",&n,&p);
vector<int> a(n);
for (auto&e:a) scanf("%d",&e);
for (int i=0;i<n;i++) if (a[i]%2) o++;
e=n-o;
int even[e];
int odd[o];
for (int i=0;i<e;i++) even[i]=COM(e,i);
for (int i=0;i<o;i++) odd[i]=COM(o,i);
if (p==0) {
if (e==0 || o==0) {
ans++;
} else {
ans+=2;
}
if (e>0){
for (int i=0;i<o;i++) {
for (int j=0;j<e;j++) {
ans+=odd[i]*even[j];
}
i++;
}
} else {
for (int i=1;i<o;i++) {
ans+=odd[i];
i++;
}
}
} else {
for (int i=1;i<o;i++) {
ans+=odd[i];
i++;
}
}
printf("%d\n",ans);
return 0;
} | a.cc:71:11: error: redefinition of 'const int MAX'
71 | const int MAX=510000;
| ^~~
a.cc:4:11: note: 'const int MAX' previously defined here
4 | const int MAX=510000;
| ^~~
a.cc:72:11: error: redefinition of 'const int MOD'
72 | const int MOD=1000000007;
| ^~~
a.cc:5:11: note: 'const int MOD' previously defined here
5 | const int MOD=1000000007;
| ^~~
a.cc:74:11: error: redefinition of 'long long int fac [510000]'
74 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:7:11: note: 'long long int fac [510000]' previously declared here
7 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:74:21: error: redefinition of 'long long int finv [510000]'
74 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~~
a.cc:7:21: note: 'long long int finv [510000]' previously declared here
7 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~~
a.cc:74:32: error: redefinition of 'long long int inv [510000]'
74 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:7:32: note: 'long long int inv [510000]' previously declared here
7 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:76:6: error: redefinition of 'void COMinit()'
76 | void COMinit() {
| ^~~~~~~
a.cc:9:6: note: 'void COMinit()' previously defined here
9 | void COMinit() {
| ^~~~~~~
a.cc:86:11: error: redefinition of 'long long int COM(int, int)'
86 | long long COM(int n,int k) {
| ^~~
a.cc:19:11: note: 'long long int COM(int, int)' previously defined here
19 | long long COM(int n,int k) {
| ^~~
a.cc:93:5: error: redefinition of 'int main()'
93 | int main(){
| ^~~~
a.cc:26:5: note: 'int main()' previously defined here
26 | int main(){
| ^~~~
|
s853197986 | p03665 | C++ | #include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
ll comb(int n, int r) {
static vector<vector<ll>> memo(51, vector<ll>(26));
if (r > n / 2) return comb(n, n - r);
if (memo[n][r]) return memo[n][r];
if (r == 0) memo[n][0] = 1;
else memo[n][r] = comb(n - 1, r - 1) + comb(n - 1, r);
return memo[n][r];
}
class question {
public:
int N, P;
int odd = 0;
void gets() {
cin >> N >> P;
REP(i, N) {
int a;
cin >> a;
odd += a % 2;
}
}
void ans() {
ll res = 0;
if (P == 0) {
for (int i = 0;i <= odd;i += 2) {
res += comb(odd, i);
}
}
else {
for (int i = 1;i <= odd;i += 2) {
res += comb(odd, i);
}
}
res *= (1LL << (N - odd));
cout << res << "\n";
}
}; | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s970901305 | p03665 | C++ | #include<algorithm>
#include<cstring>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
int n,a[55],p;
int f[55][55];
int C(int x,int y){return f[y][x];}
void pre()
{
f[1][1]=f[1][0]=f[0][0]=1;
for(int i=2;i<=50;i++)
{
f[i][0]=f[i][i]=1;
for(int j=1;j<i;j++)
f[i][j]=f[i-1][j]+f[i-1][j-1];
}
}
int main()
{
int i;int zz=0,oo=0;ll ans=0,pw=1;
scanf("%d%d",&n,&p);
for(i=1;i<=n;i++) scanf("%d",&a[i]),(a[i]&1)?oo++:zz++;
for(i=1;i<=zz;i++) pw<<=1ll;pre();
if(p&1)
for(i=1;i<=oo;i+=2)
ans+=C(i,oo)*pw;
else
for(i=0;i<=oo;i+=2)
ans+=C(i,oo)*pw;
printf("%lld\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:24:9: error: 'scanf' was not declared in this scope
24 | scanf("%d%d",&n,&p);
| ^~~~~
a.cc:33:9: error: 'printf' was not declared in this scope
33 | printf("%lld\n",ans);
| ^~~~~~
a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
3 | #include<cmath>
+++ |+#include <cstdio>
4 | #include<algorithm>
|
s732414348 | p03665 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
int main()
{
int n, p;
cin >> n >> p;
int a;
int flag = 0;
REP(i, n){
cin >> a;
if (a % 2) flag = 1;
}
ll ans = 1;
FOR(i, 1, n){
ans *= 2;
}
if (flag) cout << ans << endl;
else cout << (p ? 0 : ans) endl;
}
| a.cc: In function 'int main()':
a.cc:28:35: error: expected ';' before 'endl'
28 | else cout << (p ? 0 : ans) endl;
| ^~~~~
| ;
|
s897765042 | p03665 | Java | import java.io.*;
import java.util.*;
public class Main {
private void compute(){
Scanner scanner = new Scanner (System.in);
int n = scanner.nextInt();
int p = scanner.nextInt();
int e, o;
for (int i=0;i<n;i++) {
if (scanner.nextInt() % 2 == 0)
e++;
else
o++;
}
long rtn = 1;
if (p == 1) {
rtn *= o;
o--;
}
long or, er;
for (int i=0;i<=o;i+=2) {
or += co(o, i);
}
for (int i=0;i<=e;i++) {
er += co(e, i);
}
System.out.println("");
}
private static long co(int n, int k) {
long rtn = 1;
for (int i=0;i<k;i++) {
rtn *= n - i;
rtn /= i + 1;
}
return rtn;
}
public static void main(String[] args) {
new Main().compute();
}
}
| Main.java:13: error: variable e might not have been initialized
e++;
^
Main.java:15: error: variable o might not have been initialized
o++;
^
Main.java:19: error: variable o might not have been initialized
rtn *= o;
^
Main.java:23: error: variable o might not have been initialized
for (int i=0;i<=o;i+=2) {
^
Main.java:24: error: variable or might not have been initialized
or += co(o, i);
^
Main.java:26: error: variable e might not have been initialized
for (int i=0;i<=e;i++) {
^
Main.java:27: error: variable er might not have been initialized
er += co(e, i);
^
7 errors
|
s449232917 | p03665 | Java | import java.io.*;
import java.util.*;
public class Main {
private void compute(){
Scanner scanner = new Scanner (System.in);
int n = scanner.nextInt();
int p = scanner.nextInt();
int e, o;
for (int i=0;i<n;i++) {
if (scanner.nextInt() % 2 == 0)
e++;
else
o++;
}
long rtn = 1;
if (p == 1) {
rtn *= o;
o--;
}
long or, er;
for (int i=0;i<=o;i+=2) {
or += co(o, i);
}
for (int i=0;i<=e;i++) {
er += co(e, i);
}
System.out.println("");
}
private static long co(int n, k) {
long rtn = 1;
for (int i=0;i<k;i++) {
rtn *= n - i;
rtn /= i + 1;
}
return rtn;
}
public static void main(String[] args) {
new Main().compute();
}
}
| Main.java:33: error: <identifier> expected
private static long co(int n, k) {
^
1 error
|
s572978258 | p03665 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
typedef long long ll;
using namespace std;
const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;
long long int n,cnt=0,ans=0,a[1000],b,c,d,cmp[4],cmpp,m,h,w,x,y,sum=0,pos,dp[51][50*100+200];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
//-------------------------↓↓↓↓↓↓------------------------
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cin>>n>>p;
rep(i,n)cin>>a[i],sum+=a[i];
dp[0][0]=1;
rep(i,n){
rep(j,sum+1){
dp[i+1][j+a[i]]+=dp[i][j];
}
}
rep(i,sum+1){
if(i%2==p)ans+=dp[n][i];
}
Cout(ans);
return 0;
}
| a.cc: In function 'int main()':
a.cc:32:13: error: 'p' was not declared in this scope
32 | cin>>n>>p;
| ^
|
s076093381 | p03665 | C++ | include <bits/stdc++.h>
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
typedef long long ll;
using namespace std;
const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;
long long int n,cnt=0,ans=0,a[1000],b,c,d,cmp[4],cmpp,m,h,w,x,y,sum=0,pos,dp[51][50*100+200];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
//-------------------------↓↓↓↓↓↓------------------------
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cin>>n>>p;
rep(i,n)cin>>a[i],sum+=a[i];
dp[0][0]=1;
rep(i,n){
rep(j,sum+1){
dp[i+1][j+a[i]]+=dp[i][j];
}
}
rep(i,sum+1){
if(i%2==p)ans+=dp[n][i];
}
Cout(ans);
return 0;
}
| a.cc:1:1: error: 'include' does not name a type
1 | include <bits/stdc++.h>
| ^~~~~~~
a.cc:16:7: error: 'll' does not name a type; did you mean 'all'?
16 | const ll LINF = 1e18;
| ^~
| all
a.cc:21:1: error: 'string' does not name a type
21 | string alph("abcdefghijklmnopqrstuvwxyz"),s;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:28:8: error: 'cin' was not declared in this scope
28 | cin.tie(0);
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | include <bits/stdc++.h>
a.cc:29:5: error: 'ios' has not been declared
29 | ios::sync_with_stdio(false);
| ^~~
a.cc:32:13: error: 'p' was not declared in this scope
32 | cin>>n>>p;
| ^
a.cc:9:17: error: 'cout' was not declared in this scope
9 | #define Cout(x) cout<<(x)<<endl
| ^~~~
a.cc:44:3: note: in expansion of macro 'Cout'
44 | Cout(ans);
| ^~~~
a.cc:9:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
9 | #define Cout(x) cout<<(x)<<endl
| ^~~~
a.cc:44:3: note: in expansion of macro 'Cout'
44 | Cout(ans);
| ^~~~
a.cc:9:28: error: 'endl' was not declared in this scope
9 | #define Cout(x) cout<<(x)<<endl
| ^~~~
a.cc:44:3: note: in expansion of macro 'Cout'
44 | Cout(ans);
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | include <bits/stdc++.h>
|
s212036042 | p03665 | C++ | #include <bits/c++.h>
using namespace std;
int main() {
int n,p;
cin >> n >> p;
int a[p];
for (int i = 0;i < p;i++) {
cin >> a[i]
}
int pw = pow(2,n);
int ans2 = 0;
for (int i = 0;i < pw;i++) {
int ans = 0;
for (int j = n - 1;j >= 0;j++) {
int m = i;
if (m%2==1) {
ans += a[i];
}
m/=2;
}
if (ans%2==p) ans2++;
}
cout << ans2 << end;
} | a.cc:1:10: fatal error: bits/c++.h: No such file or directory
1 | #include <bits/c++.h>
| ^~~~~~~~~~~~
compilation terminated.
|
s187658437 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
int sisu(int a,int b){
int c=a;
for(int i=0;i!=b;i++){
a=a*c;
}
a=a/c;
return a;
}
long nCr(int n, int r){
long ans=1;
for(int i=n;i>n-r;--i){
ans = ans*i;
}
for(int i=1;i<r+1;++i){
ans=ans/i;
}
return ans;
}
int main(){
int n,p,a[50];
cin >> n >> p;
int amari=0;
int zero=0;
int erabu=1;
int b;
for(int i=0;i!=n;i++){
cin >> a[i];
a[i]=a[i]%2;
if(a[i]==1){
amari++;
}
else{
zero++;
}
}
if(p==1){
if(amari%2==0){
b=amari-1;
}
else{
b=amari;
}
erabu=sisu(2,zero);
for(int i=1;i!=b+2;i+2){
erabu=erabu*nCr(amari,i);
}
}
else{
if(amari%2==1){
b=amari-1;
}
else{
b=amari;
}
erabu=sisu(2,zero);
for(int i=2;i!=b+2;i+2;){
erabu=erabu*nCr(amari,i);
}
}
cout << erabu << endl;
}
| a.cc: In function 'int main()':
a.cc:61:27: error: expected ')' before ';' token
61 | for(int i=2;i!=b+2;i+2;){
| ~ ^
| )
a.cc:61:28: error: expected primary-expression before ')' token
61 | for(int i=2;i!=b+2;i+2;){
| ^
|
s218199202 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
int sisu(int a,int b){
int c=a;
for(int i=0;i!=b;i++){
a=a*c;
}
a=a/c;
return a;
}
long nCr(int n, int r){
long ans=1;
for(int i=n;i>n-r;--i){
ans = ans*i;
}
for(int i=1;i<r+1;++i){
ans=ans/i;
}
return ans;
}
int main(){
int n,p,a[50];
cin >> n >> p;
int amari=0;
int zero=0;
int erabu=1;
int b;
for(int i=0;i!=n;i++){
cin >> a[i];
a[i]=a[i]%2;
if(a[i]==1){
amari++;
}
else{
zero++;
}
}
if(p==1){
if(amari%2==0){
b=amari-1;
}
else{
b=amari;
}
erabu=sisu(2,zero);
for(int i=1;i!=b+2;i+2;){
erabu=erabu*nCr(amari,i);
}
}
else{
if(amari%2==1){
b=amari-1;
}
else{
b=amari;
}
erabu=sisu(2,zero);
for(int i=2;i!=b+2;i+2;){
erabu=erabu*nCr(amari,i);
}
}
cout << erabu << endl;
}
| a.cc: In function 'int main()':
a.cc:49:27: error: expected ')' before ';' token
49 | for(int i=1;i!=b+2;i+2;){
| ~ ^
| )
a.cc:49:28: error: expected primary-expression before ')' token
49 | for(int i=1;i!=b+2;i+2;){
| ^
a.cc:61:27: error: expected ')' before ';' token
61 | for(int i=2;i!=b+2;i+2;){
| ~ ^
| )
a.cc:61:28: error: expected primary-expression before ')' token
61 | for(int i=2;i!=b+2;i+2;){
| ^
|
s209453153 | p03665 | C++ | #include<bits/stdc++.h>
using namespace std;
int sisu(int a,int b){
int c=a;
for(int i=0;i!=b;i++){
a=a*c;
}
a=a/c;
return a;
}
long nCr(int n, int r){
long ans=1;
for(int i=n;i>n-r;--i){
ans = ans*i;
}
for(int i=1i<r+1;++i){
ans=ans/i;
}
return ans;
}
int main(){
int n,p,a[50];
cin >> n >> p >> endl;
int amari=0;
int zero=0;
int erabu=1;
int b;
for(int i=0;i!=n;i++){
cin >> a[i];
a[i]=a[i]%2;
if(a[i]==1){
amari++;
}
else{
zero++;
}
}
if(p==1){
if(amari%2==0){
b=amari-1;
}
else{
b=amari;
}
erabu=sisu(2,zero);
for(int i=1;;i!=b+2;i+2;){
erabu=erabu*nCr(amari,i);
}
}
else{
if(amari%2==1){
b=amari-1;
}
else{
b=amari;
}
erabu=sisu(2,zero);
for(int i=2;;i!=b+2;i+2;){
erabu=erabu*nCr(amari,i);
}
}
cout << erabu << endl;
}
| a.cc: In function 'long int nCr(int, int)':
a.cc:19:15: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'int')
19 | for(int i=1i<r+1;++i){
| ~~^~~~
| | |
| | int
| std::complex<double>
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | for(int i=1i<r+1;++i){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
19 | for(int i=1i<r+1;++i){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>'
19 | for(int i=1i<r+1;++i){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
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/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: 'std::complex<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
19 | for(int i=1i<r+1;++i){
| ^
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++ |
s849372910 | p03665 | C++ | n,m=map(int,input().split())
s=list(map(int,input().split()))
odd=0
even=0
p=0
for i in s:
if i%2==1:
odd+=1
else:
even+=1
even=2**even
from math import factorial
def f(n,m):
return factorial(n)//(factorial(n-m)*factorial(m))
for i in range(1,odd+1,2):
p+=f(odd,i)
print(p*even) | a.cc:1:1: error: 'n' does not name a type
1 | n,m=map(int,input().split())
| ^
|
s366438954 | p03665 | C++ | #include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
#include<unordered_map>
#include<list>
#include<fstream>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
const ll E=1e18+7;
#define F first
#define S second
#define MK make_pair
const ll MOD=1000000007;
vector<vector<ll>> mk_c(){
ll mx=55;
vector<vector<ll>> c(mx+1,vector<ll>(mx+1,0));
for(ll i=0;i<=mx;i++){
c[i][i]=1;
c[i][0]=1;
for(ll t=1;t<i;t++){
c[i][t]=c[i-1][t-1]+c[i-1][t];
}
}
return c;
}
int main(){
vector<vector<ll>> c=mk_c();
ll n,p;
cin>>n>>p;
ll g=0,k=0;
for(int i=0;i<n;i++){
ll b;
cin>>b;
if(b%2==0){g++;}
else{k++;}
}
g=1<<g;
ll K=0;
if(p==1){
assert(false;)
for(int i=1;i<=k;i+=2){
K+=c[k][i];
}
}
else{
for(int i=0;i<=k;i+=2){
K+=c[k][i];
}
}
cout<<g*K<<endl;
return 0;
}
| In file included from /usr/include/c++/14/cassert:44,
from a.cc:16:
a.cc: In function 'int main()':
a.cc:63:21: error: expected ')' before ';' token
63 | assert(false;)
| ^
a.cc:63:21: error: expected ')' before ';' token
a.cc:63:9: note: to match this '('
63 | assert(false;)
| ^~~~~~
a.cc:63:9: error: expected primary-expression before ')' token
63 | assert(false;)
| ^~~~~~
a.cc:64:21: error: 'i' was not declared in this scope
64 | for(int i=1;i<=k;i+=2){
| ^
|
s021777001 | p03665 | C++ | #include<iostream>
using namespace std;
int main(){
int n, p;
cin >> n >> p;
int a[n];
bool odd = false;
for(int i = 0; i < n; i++){
cin >> a[i];
if(a[i]%2 == 1) odd = true;
}
if(odd == false && p == 0){
ll ans = 1;
for(int i = 0; i < n; i++) ans *= 2;
cout << ans << endl;
}else if(odd == false && p == 1){
cout << 0 << endl;
}else{
ll ans = 1;
for(int i = 0; i < n-1; i++) ans *= 2;
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:9: error: 'll' was not declared in this scope
16 | ll ans = 1;
| ^~
a.cc:17:37: error: 'ans' was not declared in this scope; did you mean 'abs'?
17 | for(int i = 0; i < n; i++) ans *= 2;
| ^~~
| abs
a.cc:18:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
18 | cout << ans << endl;
| ^~~
| abs
a.cc:22:9: error: 'll' was not declared in this scope
22 | ll ans = 1;
| ^~
a.cc:23:39: error: 'ans' was not declared in this scope; did you mean 'abs'?
23 | for(int i = 0; i < n-1; i++) ans *= 2;
| ^~~
| abs
a.cc:24:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
24 | cout << ans << endl;
| ^~~
| abs
|
s176114009 | p03665 | C++ | //海老原祐輔
//J4-180012
//Biscuits
//https://beta.atcoder.jp/contests/agc017/tasks/agc017_a
//サンプルケースは全て通るが一部のテストケースにおいてWAになります。
//原因がよくわかりません。
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define range(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) range(i, 0, n)
int main()
{
ll N, P;
cin >> N >> P;
vll A(N);
rep(i, N) cin >> A[i];
vll odd(2, 0), even(2, 0);
for (int i=0;i<N+1,++i){
even[i]=0;
odd[i]=0;
}
even[0] = 1;
odd[0] = 0;
rep(i, N)
{
if (A[i + 1] % 2 == 0) {
//入れる場合
even[(i + 1) % 2] = even[i % 2];
odd[(i + 1) % 2] = odd[i % 2];
//入れない場合
even[(i + 1) % 2] += even[i % 2];
odd[(i + 1) % 2] += odd[i % 2];
} else {
//入れる場合
even[(i + 1) % 2] = even[i % 2];
odd[(i + 1) % 2] = odd[i % 2];
//入れない場合
even[(i + 1) % 2] += odd[i % 2];
odd[(i + 1) % 2] += even[i % 2];
}
}
if (P == 0) {
cout << even[(N) % 2] << endl;
} else {
cout << odd[(N) % 2] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:25:31: error: expected ';' before ')' token
25 | for (int i=0;i<N+1,++i){
| ^
| ;
|
s677077266 | p03665 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
using namespace std;
#define ll long long
ll MAX(ll a, ll b) {
if (a > b)return a;
else return b;
}
ll MIN(ll a, ll b) {
if (a < b)return a;
else return b;
}
ll powsur(ll a, ll b, ll p) {
if (b == 0) {
return 1;
}
else if (b % 2 == 0) {
ll d = powsur(a, b / 2, p);
return ((d%p)*(d%p)) % p;
}
else {
return ((a%p)*powsur(a, b - 1, p) % p) % p;
}
}
//pは素数,aのb乗をpで割った余り
ll CMOD(ll n, ll r, ll p) {
ll a = 1, b = 1, c = 1, re;
for (int i = 1; i <= n; i++) {
a *= i;
a = a%p;
}
for (int i = 1; i <= r; i++) {
b *= i;
b = b%p;
}
for (int i = 1; i <= n - r; i++) {
c *= i;
c = c%p;
}
b = powsur(b, p - 2, p);
c = powsur(c, p - 2, p);
re = ((a%p)*(b%p)) % p;
re = ((re%p)*c%p) % p;
return re;
}
//pは素数,(nCr)%p
ll gcd(ll a, ll b) {
if (a < b) {
ll tmp = a;
a = b;
b = tmp;
}
if (a%b == 0)return b;
return gcd(b, a%b);
}
//最大公約数
ll lcm(ll a, ll b) {
return a / gcd(a, b)*b;
}
//最小公倍数
ll ncr(ll n, ll r) {
ll ret = 1;
for (ll i = 0; i < r; i++) {
ret *= n - i;
ret /= i + 1;
}
return ret;
}
int main() {
int N, P, even = 0, odd = 0;
ll ans = 0;
cin >> N >> P;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
if (a % 2 == 0)even++;
else odd++;
}
if (P == 0) {
ans = pow(2, even);
ll tmp = 0;
for (int i = 0; i <= odd; i += 2) {
tmp += ncr(odd, i);
}
ans *= tmp;
cout << ans << endl;
}
else {
ans = pow(2, even);
ll tmp = 0;
for (int i = 1; i <= odd; i += 2) {
tmp += ncr(odd, i);
}
ans *= tmp;
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:122:23: error: 'pow' was not declared in this scope
122 | ans = pow(2, even);
| ^~~
a.cc:131:23: error: 'pow' was not declared in this scope
131 | ans = pow(2, even);
| ^~~
|
s146124228 | p03665 | C++ | #include<iostream>
using namespace std;
typedef long long ll
ll pow(int a,int b){
ll ans=1;
for(int j=0;j<b;j++){
ans*=a;
}
return ans;
}
int main(){
int n,p;
cin>>n>>p;
int a[n];
for(int j=0;j<n;j++){
cin>>a[j];
if(a[j]%2==1){
cout<<pow(2,n-1);
return 0;
}
}
if(p==0)cout<<pow(2,n);
if(p==1)cout<<0;
return 0;
} | a.cc:4:1: error: expected initializer before 'll'
4 | ll pow(int a,int b){
| ^~
a.cc: In function 'int main()':
a.cc:19:19: error: 'pow' was not declared in this scope
19 | cout<<pow(2,n-1);
| ^~~
a.cc:23:19: error: 'pow' was not declared in this scope
23 | if(p==0)cout<<pow(2,n);
| ^~~
|
s347767946 | p03665 | C++ | #include<iostream>
using namespace std;
int main(){
int n,p;
cin>>n>>p;
int a[n];
for(int j=0;j<n;j++){
cin>>a[j];
if(a[j]%2==1){
cout<<2**(n-1);
return 0;
}
}
if(p==0)cout<<2**n;
if(p==1)cout<<0;
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:21: error: invalid type argument of unary '*' (have 'int')
10 | cout<<2**(n-1);
| ^~~~~~
a.cc:14:21: error: invalid type argument of unary '*' (have 'int')
14 | if(p==0)cout<<2**n;
| ^~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.