submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s192808955 | p03846 | C++ | #include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define NMAX 103
#define MMAX 103
//コメントアウトするとdebug()を実行しない
#define DEBUG
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
typedef pair<int ,int > P;
typedef long long ll;
int N,A[NMAX],ans = 1;
int C;
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
dy[8] = {1,1,0,-1,-1,-1,0,1};
int solve(){
if(N%2){
for (int i = 0; i < N; ++i)
{
if(A[i]%2){
ans = 0;
return 0;
}
}
for (int i = 0; i < N/2+1; ++i)
{
ans *= 2;
}
}else{
for (int i = 0; i < N; ++i)
{
if(!A[i]%2){
ans = 0;
return 0;
}
}
for (int i = 0; i < N/2; ++i)
{
ans *= 2;
}
}
return 0;
}
void debug(){
}
void answer(){
cout << ans << "\n";
}
int main(){
cin >> N;
for (int i = 0; i < N; ++i)
{
cin >> A[i];
}
c = solve();
answer();
return 0;
} | a.cc: In function 'int main()':
a.cc:77:9: error: 'c' was not declared in this scope
77 | c = solve();
| ^
|
s005858061 | p03846 | C++ | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
#define ll long long
#define PI acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
//差の絶対値が同じ人は二人(0を除く)
//Nが奇数の時:差は0~N-1,0の人は真ん中のみ
//Nが偶数の時:差は1~N-1
//iさんは2通り
ll MOD = pow(10, 9) + 1;
int main(void){
int N;
cin >> N;
int d[N];
ll ans = 1;
FOR(i, 0, N) d[i] = 0;
FOR(i, 0, N){
int n;cin>>n;
d[n]++;
}
if(N%2==0 && d[0]!=0)){
cout<<0<<endl;
return 0;
}
if(N%2==1 && d[0]!=1){
cout<<0<<endl;
return 0;
}
FOR(i, 0, N){
if(d[i]>2){
cout<<0<<endl;
return 0;
}
}
FOR(i, 0, N/2){
ans *= 2;
ans %= MOD;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:37:26: error: expected primary-expression before ')' token
37 | if(N%2==0 && d[0]!=0)){
| ^
|
s471461085 | p03846 | C++ | /*************************************************************************
> File Name: test.cpp
> Author: Akira
> Mail: qaq.febr2.qaq@gmail.com
************************************************************************/
#include<bits/stdc++.h>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define Sqr(a) ((a)*(a))
using namespace std;
#define MaxN 100001
#define MaxM MaxN*10
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626
const int mod = 1E9+7;
const double eps = 1e-6;
#define bug cout<<88888888<<endl;
#define debug(x) cout << #x" = " << x << endl;
int N;
int diff[MaxN];
LL PowerMod(LL a, LL b, LL c)
{
LL ans = 1;
a = a % c;
while(b>0)
{
if(b % 2 == 1) ans = (ans * a) % c;
b = b/2;
a = (a * a) % c;
}
return ans;
}
int main()
{
//std::ios::sync_with_stdio(false);
scanf("%d", &N);
for(int i=1;i<=N;i++) scanf("%d", &diff[i]);
sort(diff+1, diff+1+N, [](int x,int y)return{x>y;});
bool flag = true;
int cnt = N-1, num = 0;
for(int i=1;i<=N&&flag;i++)
{
if(diff[i] == cnt)
{
num++;
if(num==2)
{
cnt -=2;
num = 0;
}
}
else flag = false;
}
if(flag) printf("%lld\n", PowerMod(2,N/2,mod));
else puts("0");
//system("pause");
}
| a.cc: In lambda function:
a.cc:43:43: error: expected '{' before 'return'
43 | sort(diff+1, diff+1+N, [](int x,int y)return{x>y;});
| ^~~~~~
a.cc: In function 'int main()':
a.cc:43:43: error: expected ')' before 'return'
43 | sort(diff+1, diff+1+N, [](int x,int y)return{x>y;});
| ~ ^~~~~~
| )
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:7:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = int*; _Iterator2 = int*; _Compare = main()::<lambda(int, int)>]':
/usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
1777 | if (__comp(__i, __first))
| ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int*; _Compare = main()::<lambda(int, int)>]'
4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:43:9: required from here
43 | sort(diff+1, diff+1+N, [](int x,int y)return{x>y;});
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:158:30: error: void value not ignored as it ought to be
158 | { return bool(_M_comp(*__it1, *__it2)); }
| ~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_comp_iter<_Compare>::operator()(_Value&, _Iterator) [with _Value = int; _Iterator = int*; _Compare = main()::<lambda(int, int)>]':
/usr/include/c++/14/bits/stl_algo.h:1757:20: required from 'void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Val_comp_iter<main()::<lambda(int, int)> >]'
1757 | while (__comp(__val, __next))
| ~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1785:36: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
1785 | std::__unguarded_linear_insert(__i,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
1786 | __gnu_cxx::__ops::__val_comp_iter(__comp));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int*; _Compare = main()::<lambda(int, int)>]'
4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:43:9: required from here
43 | sort(diff+1, diff+1+N, [](int x,int y)return{x>y;});
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:240:30: error: void value not ignored as it ought to be
240 | { return bool(_M_comp(__val, *__it)); }
| ~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = int*; _Value = int; _Compare = main()::<lambda(int, int)>]':
/usr/include/c++/14/bits/stl_heap.h:140:48: required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = int*; _Distance = long int; _Tp = int; _Compare = __gnu_cxx::__ops::_Iter_comp_val<main()::<lambda(int, int)> >]'
140 | while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:247:23: required from 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = int*; _Distance = long int; _Tp = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
247 | std::__push_heap(__first, __holeIndex, __topIndex,
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
248 | _GLIBCXX_MOVE(__value), __cmp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:356:22: required from 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
356 | std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value),
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
357 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
1593 | std::__make_heap(__first, __middle, __comp);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<main()::<lambda(int, int)> >]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int*; _Compare = main()::<lambda(int, int)>]'
4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:43:9: required from here
43 | sort(diff+1, diff+1+N, [](int x,int y)return{x>y;});
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:196:30: error: void value not ignored as it ought to be
196 | { return bool(_M_comp(*__it, __val)); }
| ~~~~~~~^~~~~~~~~~~~~~
|
s522430769 | p03846 | C++ | import java.util.*;
// ABC 50-C
// http://abc050.contest.atcoder.jp/tasks/arc066_a
public class Main {
static int n;
static int max;
static int answer = 0;
static int MOD = 1000000007;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
n = in.nextInt();
int[] diff = new int[n + 1];
for (int i = 1; i <= n; i++) {
diff[i] = in.nextInt();
}
int[] used = new int[n + 1];
int[] order = new int[n];
solve(0, diff, used, order);
System.out.println(answer);
}
public static void solve(int index, int[] diff, int[] used, int[] order) {
if (index == n) {
answer++;
if (answer == MOD) {
answer = 0;
}
// System.out.printf("order: ");
// for (int i = 0; i < n; i++) {
// System.out.printf("%d ", order[i]);
// }
// System.out.println();
return;
}
int left = index;
int right = n - index - 1;
int d = Math.abs(left - right);
for (int i = 1; i <= n; i++) {
if (diff[i] == d && used[i] == 0) {
order[index] = i;
used[i] = 1;
solve(index + 1, diff, used, order);
used[i] = 0;
}
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
6 | public class Main {
| ^~~~~~
|
s700118922 | p03846 | C++ | #include"sort.h"
#include<stdio.h>
#include<iostream>
using namespace std;
int power(int n){
if(n == 0){
return 1;
}
if(n % 2 == 1){
return (2 * power(n - 1)) % 1000000007;
}else{
return power(n / 2) * power(n / 2) % 1000000007;
}
}
int main(){
int n;
bool flag = true;
cin >> n;
int a[n];
for(int i = 0; i < n; ++i){
cin >> a[i];
}
quick_sort(a, n);
if(n % 2 == 1){
if(a[0] != 0){
cout << 0 << "\n";
}else{
for(int i = 1; i < n - 1; i += 2){
if(a[i] != i + 1 || a[i + 1] != i + 1){
cout << 0 << "\n";
flag = false;
break;
}
}
if(flag == true){
cout << power((n - 1) / 2) << "\n";
}
}
}else{
for(int i = 0; i < n - 1; i += 2){
if(a[i] != i + 1 || a[i + 1] != i + 1){
cout << 0 << "\n";
flag = false;
break;
}
}
if(flag == true){
cout << power(n / 2) << "\n";
}
}
return 0;
} | a.cc:1:9: fatal error: sort.h: No such file or directory
1 | #include"sort.h"
| ^~~~~~~~
compilation terminated.
|
s675459549 | p03846 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define int ll
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
int read(){
int i;
scanf("%lld",&i);
return i;
}
signed main(){
// your code goes here
int N=read();
vector<int> A;
REP(i,N) A.push_back(read());
sort(A.begin(),A.end());
for(int i=1;i<N;i+=2){
REP(j,2){
if(A.back()!=N-i){
cout << 0;
return 0;
}
A.pop_back();
}
}
if(N%2!=0&&A.back()!=0){
cout << 0;
return 0;
}
cout << pow(2,N/2)%(100000000+7);
} | a.cc: In function 'int main()':
a.cc:36:27: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
36 | cout << pow(2,N/2)%(100000000+7);
| ~~~~~~~~~~^~~~~~~~~~~~~~
| | |
| | int
| __gnu_cxx::__promote<double>::__type {aka double}
|
s125352147 | p03846 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++) // ex)REP(i,10) i=0~i=9
#define REPR(i, n) for(int i = n;i >= 0;i--) // ex)REPR(i,10) i=10~i=0
#define FOR(i, m, n) for(int i = m;i < n;i++) //ex)FOR(i,3,10) i=3~i=9
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end()); //
#define llong long long //64bitに拡張
#define pb(a) push_back(a)
#define INF 999999999 //大きな値
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//座標上を探索
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
int main(){
llong N;
llong A[100000];
int count[100000] = ;
bool judge = true;
llong answer = 1;
cin >> N;
for(int i=0;i<N;i++){
count[i] = 0;
}
for(int i=0;i<N;i++){
cin >> A[i];
count[A[i]]++;
}
if(N%2 == 0){
if(count[0] > 0){
judge = false;
}
for(int i=1;i<N;i=i+2){
if(count[i] != 2){
judge = false;
}
}
if(judge == true){
for(int l=0;l<N/2;l++){
answer = answer * 2;
}
answer = answer % 1000000007;
cout << answer << endl;
}else{
cout << 0 << endl;
}
}else{
if(count[0] != 1){
judge = false;
}
for(int i=2;i<N;i = i + 2){
if(count[i] != 2){
judge = false;
}
}
if(judge == true){
for(int l=0;l<(N-1)/2;l++){
answer = answer * 2;
}
answer = answer % 1000000007;
cout << answer << endl;
}else{
cout << 0 << endl;
}
}
}
| a.cc:9:27: error: extended character is not valid in an identifier
9 | #define pb(a) push_back(a)
| ^
a.cc: In function 'int main()':
a.cc:23:29: error: expected primary-expression before ';' token
23 | int count[100000] = ;
| ^
|
s752723954 | p03846 | C++ | #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
//#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
int y[100005] = {};
cin >> n;
bool f = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (n == 1) {
if (!x )cout << 1 << endl;
else cout << 0 << endl;
return 0;
}
if (x >= n)f = 1;
if (n % 2) {
if (!x)y[x]++;
else if (x % 2) {
f = 1;
}
else y[x]++;
}
else {
if (x % 2==0 ) {
if (x) {
f = 1;
}
}
else y[x]++;
}
}
for (int i = 0; i <= 100000; i++) {
if (n % 2) {
if (i&&y[i]&&i%2)f = 1;
if (y[0] != 1)f = 1;
if (y[i] != 2 && i % 2 == 0&&i<=n-1&&i)f = 1;
}
else {
if (y[i] && i % 2==0)f = 1;
//if (y[0] != 1)f = 1;
if (y[i] != 2 && i % 2&&i<n )f = 1;
}
}
if (f) {
cout << 0 << endl;
return 0;
}
cout << pow(2, (double)(n / 2))%1000000007 << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:85:40: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
85 | cout << pow(2, (double)(n / 2))%1000000007 << endl;
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
| | |
| | int
| __gnu_cxx::__promote<double>::__type {aka double}
|
s798329748 | p03846 | C | #include<stdio.h>
#include<string.h>
int main(void)
{
int kazu, number[100000], flag = 0, count[100000] = { 0 }, i, n, t;
const int MOD = 1e9 + 7;
scanf("%d", &kazu);
for (i = 0; i < kazu; i++)
{
scanf("%d", &number[i]);
count[number[i]]++;
}
for (i = 0; i < kazu; i++)
{
/*if (kazu % 2 == 0)
{
if (i % 2 == 0 && count[i] != 0)flag = 1;
if (count[0] != 0)flag = 1;
if (count[i] != 0 && count[i] != 2)flag = 1;//奇数の場合を除く
}*/
if (kazu % 2 == 1)
{
if (i % 2 == 1 && count[i] != 0)flag = 1;
if (count[0] != 1)flag = 1;
if (count[i] != 0) //偶数の場合を除く
if (i != 0 && count[i] != 2)flag = 1;
}
}
kazu = kazu / 2;
kazu *= kazu;
if (flag == 1)
printf("0");
else
printf("%d", kazu%MOD);
retrun 0;
} | main.c: In function 'main':
main.c:37:1: error: 'retrun' undeclared (first use in this function)
37 | retrun 0;
| ^~~~~~
main.c:37:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:37:7: error: expected ';' before numeric constant
37 | retrun 0;
| ^~
| ;
|
s636817218 | p03846 | C | #include<stdio.h>
#include<string.h>
int main(void)
{
int kazu, number[100000], flag = 0, count[100000] = { 0 }, i, n, t;
const int MOD = 1e9 + 7;
scanf("%d", &kazu);
for (i = 0; i < kazu; i++)
{
scanf("%d", &number[i]);
count[number[i]]++;
}
for (i = 0; i < kazu; i++)
{
if (kazu % 2 == 0)
{
if (i % 2 == 0 && count[i] != 0)flag = 1;
if (count[0] != 0)flag = 1;
if (count[i] != 0 && count[i] != 2)flag = 1;//奇数の場合を除く
}
/*if (kazu % 2 == 1)
{
if (i % 2 == 1 && count[i] != 0)flag = 1;
if (count[0] != 1)flag = 1;
if (count[i] != 0) //偶数の場合を除く
if (i != 0 && count[i] != 2)flag = 1;
}*/
}
kazu = kazu / 2;
kazu *= kazu;
if (flag == 1)
printf("0");
else
printf("%d", kazu%MOD);
retrun 0;
} | main.c: In function 'main':
main.c:37:1: error: 'retrun' undeclared (first use in this function)
37 | retrun 0;
| ^~~~~~
main.c:37:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:37:7: error: expected ';' before numeric constant
37 | retrun 0;
| ^~
| ;
|
s308763866 | p03846 | C | #include<stdio.h>
#include<string.h>
int main(void)
{
int kazu, number[100000],flag=0, count[100000] = { 0 }, i, n, t;
const int MOD = 1e9 + 7;
scanf("%d", &kazu);
for (i = 0; i < kazu; i++)
{
scanf("%d", &number[i]);
count[number[i]]++;
}
for (i = 0; i < kazu; i++)
{
if (kazu % 2 == 0)
{
if (i % 2 == 0 && count[i] != 0)flag = 1;
if (count[0] != 0)flag = 1;
if (count[i] != 0 && count[i] != 2)flag = 1;//奇数の場合を除く
}
if (kazu%2==1)
{
if (i % 2 == 1 && count[i] != 0)flag = 1;
if (count[0] != 1)flag = 1;
if (count[i]!=0) //偶数の場合を除く
if (i != 0 && count[i] != 2)flag = 1;
}
}
kazu = kazu / 2;
kazu *= kazu;
if (flag == 1)
printf("0");
else
printf("%d", kazu%MOD);
return0;
}
| main.c: In function 'main':
main.c:37:9: error: 'return0' undeclared (first use in this function)
37 | return0;
| ^~~~~~~
main.c:37:9: note: each undeclared identifier is reported only once for each function it appears in
|
s136618796 | p03846 | Java | package pac01;
import java.util.Arrays;
import java.util.Scanner;
public class LiningUp {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
//人数
int N = sc.nextInt();
int[] A = new int[N];
//絶対値の入力
int[] a = new int[N];
double P;
for(int i = 0; i < N ;i++){
a[i] = sc.nextInt();
A[i] = Math.abs((2 * i) - N + 1);
}
Arrays.sort(A);
Arrays.sort(a);
if(Arrays.equals(A,a)){
P = Math.floor(N/2) * Math.floor(N/2);
}else{
P = 0;
}
System.out.println(P / (Math.pow(10, 9) + 7));
}
} | Main.java:6: error: class LiningUp is public, should be declared in a file named LiningUp.java
public class LiningUp {
^
1 error
|
s977530485 | p03846 | Java | public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
System.out.print(" ");
Scanner sc = new Scanner(System.in);
//人数
int N = sc.nextInt();
int[] A = new int[N];
//絶対値の入力
int[] a = new int[N];
double P;
for(int i = 0; i < N ;i++){
a[i] = sc.nextInt();
A[i] = Math.abs((2 * i) - N + 1);
}
Arrays.sort(A);
Arrays.sort(a);
if(Arrays.equals(A,a)){
P = Math.floor(N/2) * Math.floor(N/2);
}else{
P = 0;
}
System.out.println(P / (Math.pow(10, 9) + 7));
} | Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
^
(use --enable-preview to enable unnamed classes)
1 error
|
s558175880 | p03846 | Java | package pac01;
import java.util.Arrays;
import java.util.Scanner;
public class LiningUp {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
System.out.print(" ");
Scanner sc = new Scanner(System.in);
//人数
int N = sc.nextInt();
int[] A = new int[N];
//絶対値の入力
int[] a = new int[N];
double P;
for(int i = 0; i < N ;i++){
a[i] = sc.nextInt();
A[i] = Math.abs((2 * i) - N + 1);
}
Arrays.sort(A);
Arrays.sort(a);
System.out.println(Arrays.toString(A));
System.out.println(Arrays.toString(a));
if(Arrays.equals(A,a)){
P = Math.floor(N/2) * Math.floor(N/2);
}else{
P = 0;
}
System.out.println(P / (Math.pow(10, 9) + 7));
}
} | Main.java:6: error: class LiningUp is public, should be declared in a file named LiningUp.java
public class LiningUp {
^
1 error
|
s284780770 | p03846 | C++ | #include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int N;
cin>>N;
vector<int> v;
for(int i=0;i<N;i++){
int tmp;
cin>>tmp;
v.push_back(tmp);
}
v.sort();
bool bl=true;
if(N%2==0){
for(int i=1;i<N;i+=2){
if(v[i] != i){
bl=false;
break;
}
}
}else{
for(int i=0;i<N;i+=2){
if(v[i] != i){
bl=false;
break;
}
}
}
if(N%2==0 && bl){
cout<<( (int)(pow(2.0,(N/2)))%1000000007 )<<endl;
}else if(bl){
cout<<( (int)(pow(2.0,((N-1)/2)))%1000000007 )<<endl;
}else{
cout<<0<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:11: error: 'class std::vector<int>' has no member named 'sort'
16 | v.sort();
| ^~~~
|
s053461164 | p03846 | C++ | #include<iostream>
using namespace std;
int main(){
int N;
cin>>N;
if(N%2==0){
cout<<(2^(N/2))/(10^9 + 7)<<endl;
}else{
cout<<(2^((N-1)/2)/(10^9 + 7)<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:46: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
10 | cout<<(2^((N-1)/2)/(10^9 + 7)<<endl;
| ~~~~~~~~~~~~~~~~~~~~^~~~~~
a.cc:10:52: error: expected ')' before ';' token
10 | cout<<(2^((N-1)/2)/(10^9 + 7)<<endl;
| ~ ^
| )
|
s502566091 | p03846 | C++ | long M=1e9+7,s[1<<17],a,i,f;
long p(long a,int b){return b?b%2?p(a*a%M,b/2)*a%M:p(a*a%M,b/2)%M:1;}
main(n)
{
for(scanf("%d",&n);~scanf("%d",&a);s[a]++);
if(n%2)for(f|=*s-1;++i<n;)f|=(i%2?s[i]:s[i]-2)?1:0;
else for(f|=*s;++i<n;)f|=(i%2?s[i]-2:s[i])?1:0;
printf("%d\n",f?0:p(2,n/2));
}
| a.cc:3:5: error: expected constructor, destructor, or type conversion before '(' token
3 | main(n)
| ^
|
s486892106 | p03846 | C++ | using namespace std;
int main() {
int n;
cin >> n;
int *a = new int[n];
for (int i = 0; i < n; i++)cin >> a[i];
//解の存在確認
int *ax = new int[(n + n % 2) / 2];
for (int i = 0; i < (n + n % 2) / 2; i++) ax[i] = 0;
bool check = true;
if (n % 2) {
ax[0] = 1;
for (int i = 0; i < n; i++) ax[a[i] / 2]++;
for (int i = 0; i < (n + n % 2) / 2; i++) {
if (ax[i] != 2) {
check = false;
break;
}
}
}
else {
for (int i = 0; i < n; i++) ax[(a[i] - 1) / 2]++;
for (int i = 0; i < (n + n % 2) / 2; i++) {
if (ax[i] != 2) {
check = false;
break;
}
}
}
if (check) {
int iter = (n - n % 2) / 2;
int s = 1;
for (int i = 0; i < iter; i++) {
s = s % 1000000007;
s *= 2;
}
cout << s << endl;
}
else cout << 0 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
4 | cin >> n;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:37:17: error: 'cout' was not declared in this scope
37 | cout << s << endl;
| ^~~~
a.cc:37:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:30: error: 'endl' was not declared in this scope
37 | cout << s << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using namespace std;
a.cc:39:14: error: 'cout' was not declared in this scope
39 | else cout << 0 << endl;
| ^~~~
a.cc:39:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:39:27: error: 'endl' was not declared in this scope
39 | else cout << 0 << endl;
| ^~~~
a.cc:39:27: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s595648334 | p03846 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int N = 0;
long long result = 0.0, p1;
cin >> N;
p1 = (pow(10, 9) + 7);
if(N % 2 == 0){
N /= 2;
result = pow(2 , N) % p1;
}
else {
N = (N-1) / 2;
result = pow(2, N) % p1;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:25: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
15 | result = pow(2 , N) % p1;
| ~~~~~~~~~~ ^ ~~
| | |
| | long long int
| __gnu_cxx::__promote<double>::__type {aka double}
a.cc:19:25: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
19 | result = pow(2, N) % p1;
| ~~~~~~~~~ ^ ~~
| | |
| | long long int
| __gnu_cxx::__promote<double>::__type {aka double}
|
s418016206 | p03846 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int N = 0;
cin >> N;
if(N % 2 == 0){
N /= 2;
cout << pow(2 , N) % (pow(10, 9) + 7);
}
else {
N = (N-1) / 2;
cout << pow(2, N) % (pow(10, 9) + 7);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:24: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
12 | cout << pow(2 , N) % (pow(10, 9) + 7);
| ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
| | |
| | __gnu_cxx::__promote<double>::__type {aka double}
| __gnu_cxx::__promote<double>::__type {aka double}
a.cc:16:23: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
16 | cout << pow(2, N) % (pow(10, 9) + 7);
| ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
| | |
| | __gnu_cxx::__promote<double>::__type {aka double}
| __gnu_cxx::__promote<double>::__type {aka double}
|
s618903257 | p03846 | C++ | #include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
//ranker
using namespace std;
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using psi = pair<string, int>;
using D = double;
void merge (int *first1, int *last1, int *first2, int *last2){
int size1 = last1 - first1;
int size2 = last2 - first2;
int *result = new int[size1+size2];
int i = 0;
int j = 0;
int index = 0;
while (true){
if (i < size1 && (first1[i] <= first2[j] || j >= size2)){
result[index] = first1[i];
++i; ++index;
}
if (j < size2 && (first1[i] > first2[j] || i >= size1)){
result[index] = first2[j];
++j; ++index;
}
if (i==size1 && j==size2){
for (i=0; i<size1; ++i) first1[i] = result[i];
for (j=0; j<size2; ++j) first2[j] = result[j+size1];
delete[] result;
return;
}
}
}
void MergeSort (int *first, int *last){
int size = last - first;
if(size <= 1) return;
MergeSort(first, first+size/2);
MergeSort(first+size/2, last);
merge(first, first+size/2, first+size/2, last);
}
//複数のソート
void sort2vectors(vector<int> &av, vector<int> &bv)
{
int n = av.size();
vector<int> p(n), av2(n), bv2(n);
iota(p.begin(), p.end(), 0);
sort(p.begin(), p.end(), [&](int a, int b) { return av[a] < av[b]; });
for (int i = 0; i < n; i++) {
av2[i] = av[p[i]];
bv2[i] = bv[p[i]];
}
av = av2;
bv = bv2;
}
int gcd(int a, int b)
{
int c;
if (a < b) {
a+=b; b=a-b; a-=b;
}
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
int isPrime(int x){
int i;
if(x < 2) return 0;
else if(x == 2) return 1;
if( x%2 == 0) return 0;
for(i = 3; i*i <= 2; i += 2){
if(x%i == 0) return 0;
}
return 1;
}
const int pmax = 10000000;
bool isPrime_table[pmax];
//constがないと配列宣言できない
void eratos(void){
int i, j;
double sqrtmax=sqrt(pmax);
REP(k, pmax) isPrime_table[k] = true; /* Initialization */
/* Sieve process */
isPrime_table[0] = false;
isPrime_table[1] = false;
/* 0 and 1 are not prime. */
for (i=2; i <= sqrtmax; i++){
if (isPrime_table[i]==true){ /* i is prime. */
for (j=i; i*j<pmax; j++){
isPrime_table[i*j] = false; /* multiples of i are not prime. */
}
}
}
}
//漸化式敵に記述も可能
//abs(dx[i]+dy[j])==1で四方
int dx[3]={-1, 0, 1};
int dy[3]={-1, 0, 1};
int W0, H0;
int masu0[100][100]={0};
int cnt0;
int dfs(int a, int b){
masu0[a][b] = 2;
REP(i, 3)REP(j, 3){
a = a+dx[i];
b = b+dy[j];
if(masu0[a][b]== 1 && a >= 0 && a < W0 && b >= 0 && b < H0){
dfs(a, b);
}
}
return 1;
}
//文字列取り出し str.substr(i, 5)
//文字数字変換 stoi, stod とto_string
//初期化memset
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
int N2, N0;
N2 = N/2;
N0 = N%2;
int A[N];
int c[N+10]={-1};
int temp;
REP(i, N){
cin >> temp;
c[temp]++;
}
int ans = 0;
if(N0==0){
for(int i=1; i<N; i += 2){
if(c[i] != 2){
cout << 0 << endl;
return 0;
}
}
}
if(N0==1){
if(c[0] != 1){
cout << 0 << endl;
return 0;
}
for(int i=2; i<N; i += 2){
if(c[i] != 2){
ans = 0;
cout << 0 << endl;
return 0;
}
}
}
long long int tot = 1;
REP(i, N2) (tot *= 2) %(1e9+7);
cout << tot << endl;
return 0;
}
| a.cc: In function 'void sort2vectors(std::vector<int>&, std::vector<int>&)':
a.cc:69:9: error: 'iota' was not declared in this scope
69 | iota(p.begin(), p.end(), 0);
| ^~~~
a.cc: In function 'int main()':
a.cc:199:25: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
199 | REP(i, N2) (tot *= 2) %(1e9+7);
| ~~~~~~~~~~ ^~~~~~~~
| | |
| | double
| long long int
|
s361861404 | p03846 | C++ | #include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
long long MOD = 1000000007;
int main() {
int N, A[100005];
cin>>N;
for(int i=0; i<N; i++) cin>>A[i];
/*
int m[100005];
fill(m, m+N, 0);
for(int i=0; i<N; i++){
m[(N-1)/2 - A[i]/2]++;
if((N-1)/2 - A[i]/2 != (N-1)/2 + A[i]/2) m[(N-1)/2 + A[i]/2]++;
}
long long ans = 1;
for(int i=0; i<=(N-1)/2; i++){
if(m[i] == 0 || m[i]> 2 || (i == N/2 && m[i] >1)){
cout<<0<<endl;
return 0;
}
if(i == N/2) ans = ans;
else ans = (ans % MOD) * 2 % MOD;
}
cout<<ans % MOD<<endl;
*/
sort(A, A+N);
int BE[100005], BO[100005], cnt;
cnt = 0;
for(int i=1; i<=N-1; i += 2){
BE[cnt] = i;
BE[cnt+1] = i;
cnt+=2;
}
cnt = 1;
BO[0] = 0;
for(int i=2; i<=N-1; i += 2){
BO[cnt] = i;
BO[cnt+1] = i;
cnt+=2;
}
/*
cout<<"BO"<<" : ";
for(int i=0; i<N; i++){
cout<<BO[i]<<" ";
}cout<<endl;
cout<<"BE"<<" : ";
for(int i=0; i<N; i++){
cout<<BE[i]<<" ";
}cout<<endl;
cout<<" A"<<" : ";
for(int i=0; i<N; i++){
cout<<A[i]<<" ";
}cout<<endl;
*/
if(N % 2 == 0){
for(int i = 0; i < N; i++){
if(A[i] != BE[i]){
cout<<"0"<<endl;
return 0;
}
}
}else{
for(int i = 0; i < N; i++){
if(A[i] != BO[i]){
cout<<"0"<<endl;
return 0;
}
}
}
cout<<pow(2,N/2) % MOD<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:91:20: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
91 | cout<<pow(2,N/2) % MOD<<endl;
| ~~~~~~~~~~ ^ ~~~
| | |
| | long long int
| __gnu_cxx::__promote<double>::__type {aka double}
|
s761611897 | p03846 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,temp;
cin>>n;
vector<int> x;
for(int i=0;i!=n;++i){
cin>>temp;
x.push_back(temp);
}
bool test=true;
if(n%2){
if(count(x.begin(),x.end(),0)!=1)
test=false;
for(int i=2;i<n;i+=2){
if(count(x.begin(),x.end(),i)!=2)
test=false;
}
}
else{
for(int i=1;i<n;i+=2){
if(count(x.begin(),x.end(),i)!=2)
test=false;
}
}
if(test){
long long ret=1,a=2,e=n/2,mod=1E9+7;
while(e>0){
if(e&1)
ret=(ret*a)%mod
a=(a*a)%mod
e>>=1;
}
cout<<ret<<endl;
}
else
cout<<0<<endl;
}
| a.cc: In function 'int main()':
a.cc:30:48: error: expected ';' before 'a'
30 | ret=(ret*a)%mod
| ^
| ;
31 | a=(a*a)%mod
| ~
|
s588058738 | p03846 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,temp;
cin>>n;
vector<int> x;
for(int i=0;i!=n;++i){
cin>>temp;
x.push_back(temp);
}
bool test=true;
if(n%2){
if(count(x.begin(),x.end(),0)!=1)
test=false;
for(int i=2;i<n;i+=2){
if(count(x.begin(),x.end(),i)!=2)
test=false;
}
}
else{
for(int i=1;i<n;i+=2){
if(count(x.begin(),x.end(),i)!=2)
test=false;
}
}
if(test){
long long ret=1,a=2,e=n/2,mod=1E9+7
while(e>0){
if(e&1)
ret=(ret*a)%mod
a=(a*a)%mod
e>>=1;
}
cout<<ret<<endl;
}
else
cout<<0<<endl;
}
| a.cc: In function 'int main()':
a.cc:28:17: error: expected ',' or ';' before 'while'
28 | while(e>0){
| ^~~~~
|
s162483657 | p03846 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,temp;
cin>>n;
vector<int> x;
for(int i=0;i!=n;++i){
cin>>temp;
x.push_back(temp);
}
bool test=true;
if(n%2){
if(count(x.begin(),x.end(),0)!=1)
test=false;
for(int i=2;i<n;i+=2){
if(count(x.begin(),x.end(),i)!=2)
test=false;
}
}
else{
for(int i=1;i<n;i+=2){
if(count(x.begin(),x.end(),i)!=2)
test=false;
}
}
if(test){
long long ret=1,a=2,e=n/2;
while(e>0){
if(e&1)
ret=(ret*a)%(1E9+7);
a=(a*a)%(1E9+7);
e>>=1;
}
cout<<ret<<endl;
}
else
cout<<0<<endl;
}
| a.cc: In function 'int main()':
a.cc:30:44: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
30 | ret=(ret*a)%(1E9+7);
| ~~~~~~~^~~~~~~~
| | |
| | double
| long long int
a.cc:31:32: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
31 | a=(a*a)%(1E9+7);
| ~~~~~^~~~~~~~
| | |
| | double
| long long int
|
s839701646 | p03846 | C++ |
$
| a.cc:2:1: error: '$' does not name a type
2 | $
| ^
|
s054101176 | p03846 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] an = new int[n];
int sameNum = 0;
for( int i=0; i<n; i++ ){
an[i]=sc.nextInt();
}
Arrays.sort(an);
if( n%2 == 1 && an[n-1] != 0 )
System.out.println(0);
return;
}
for( int i=(n-1)-n%2; i>0; i-=2 ){
if(an[i-1] != an[i]){
System.out.println(0);
return;
}
}
System.out.println( Math.floorMod( (long)Math.pow(2.0,n/2),((long)Math.pow(10.0,9.0)+7) ));
return;
}
}
| Main.java:19: error: illegal start of type
for( int i=(n-1)-n%2; i>0; i-=2 ){
^
Main.java:19: error: <identifier> expected
for( int i=(n-1)-n%2; i>0; i-=2 ){
^
Main.java:19: error: <identifier> expected
for( int i=(n-1)-n%2; i>0; i-=2 ){
^
Main.java:26: error: <identifier> expected
System.out.println( Math.floorMod( (long)Math.pow(2.0,n/2),((long)Math.pow(10.0,9.0)+7) ));
^
Main.java:26: error: <identifier> expected
System.out.println( Math.floorMod( (long)Math.pow(2.0,n/2),((long)Math.pow(10.0,9.0)+7) ));
^
Main.java:26: error: <identifier> expected
System.out.println( Math.floorMod( (long)Math.pow(2.0,n/2),((long)Math.pow(10.0,9.0)+7) ));
^
Main.java:26: error: <identifier> expected
System.out.println( Math.floorMod( (long)Math.pow(2.0,n/2),((long)Math.pow(10.0,9.0)+7) ));
^
Main.java:26: error: illegal start of type
System.out.println( Math.floorMod( (long)Math.pow(2.0,n/2),((long)Math.pow(10.0,9.0)+7) ));
^
Main.java:26: error: <identifier> expected
System.out.println( Math.floorMod( (long)Math.pow(2.0,n/2),((long)Math.pow(10.0,9.0)+7) ));
^
Main.java:26: error: <identifier> expected
System.out.println( Math.floorMod( (long)Math.pow(2.0,n/2),((long)Math.pow(10.0,9.0)+7) ));
^
Main.java:26: error: illegal start of type
System.out.println( Math.floorMod( (long)Math.pow(2.0,n/2),((long)Math.pow(10.0,9.0)+7) ));
^
Main.java:27: error: illegal start of type
return;
^
Main.java:29: error: class, interface, enum, or record expected
}
^
13 errors
|
s776254354 | p03846 | C | #include<stdio.h>
int main(void){
int N,i,j,tmp[50010],hoge,ans;
int A[100001];
ans =1;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&A[i]);
}
for(i=0;i<N;i++){
tmp[A[i]]++;
}
if(N%2){
for(i=1;i<N;i++){
if(i%2 == 0){
if(tmp[i] == 2){
ans *=2;
}else{
ans *=0;
}
}else{
if(tmp[i]){
ans *=0;
}
}
if(tmp[0] != 1){
ans *= 0;
}
}else{
for(i=0;i<N;i++){
if(i%2){
if(tmp[i]==2){
ans *=2;
}else{
ans *=0;
}
}else{
if(tmp[i]){
ans *=0;
}
}
}
printf("%d\n",ans);
return 0;
}
| main.c: In function 'main':
main.c:31:6: error: expected '}' before 'else'
31 | }else{
| ^~~~
main.c:50:1: error: expected declaration or statement at end of input
50 | }
| ^
|
s749076862 | p03846 | C | #include<stdio.h>
#include<limits.h>
int main(){
int diff[100000]={0};
int n,i,temp;
int max=0;
int isEven=0;
scanf("%d",&n);
scanf("%d",&temp);
diff[temp]++;
if(temp>max){
max=temp;
}
if(temp%2==0){
isEven=1;
}
for(i=1;i<n;i++){
scanf("%d",&temp);
diff[temp]++;
if(temp>max){
max=temp;
}
}
for(i=0;i<=max;i++){
printf("%d\n",diff[i]);
}
int isPossible=1;
if(isEven){//diffが1020202...{02}の並びになる
for(i=0;i<=max;i++){
if(i==0){
if(diff[i]!=1){
isPossible--;
break;
}
}else if(i%2==1){
if(diff[i]!=0){
isPossible--;
break;
}
}else{//iが0以外の偶数なので2になるべき
if(diff[i]!=2){
isPossible--;
break;
}
}
}
}else if(!isEven){//diffが020202...{02}の並びになる
for(i=0;i<=max;i++){
if(i%2==0){//iが偶数ならdiff[i]は0になるべき
if(diff[i]!=0){
isPossible--;
break;
}
}else{//iが奇数なら2
if(diff[i]!=2){
isPossible--;
break;
}
}
}
}
long long int pattern=1;
if(!isPossible){
puts("0")
}else{
if(isEven){//2^(max/2)通り
for(i=0;i<max/2;i++){
pattern *=2;
pattern %= 1000000007;
}
printf("%lld\n",pattern);
}else{//2^(max+1)/2
for(i=0;i<(max+1)/2;i++){
pattern *=2;
pattern%= 1000000007;
}
printf("%lld\n",pattern);
}
}
}
return 0;
} | main.c: In function 'main':
main.c:72:26: error: expected ';' before '}' token
72 | puts("0")
| ^
| ;
73 | }else{
| ~
main.c: At top level:
main.c:90:9: error: expected identifier or '(' before 'return'
90 | return 0;
| ^~~~~~
main.c:91:1: error: expected identifier or '(' before '}' token
91 | }
| ^
|
s462256770 | p03846 | C++ | int N;
int A[10001]={};
int B[10001][2]={};
int ans;
int main(){
scanf("%d",&N);
for(int i=1;i<=N;i++){
scanf("%d",&A[i]);
B[i][1]=(N+A[i]+1)/2;
B[i][2]=(N-A[i]+1)/2;
}
if(N%2==0){
ans==(1<<(N/2))/1000000007;
}else{
ans==(1<<((N-1)/2))/1000000007;
}
for(int i=1;i<=N;i++){
if(B[i][1]+B[i][2]!=N-1){
ans==0;
}
}
printf("%d\n",ans);
} | a.cc: In function 'int main()':
a.cc:7:9: error: 'scanf' was not declared in this scope
7 | scanf("%d",&N);
| ^~~~~
a.cc:23:9: error: 'printf' was not declared in this scope
23 | printf("%d\n",ans);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int N;
|
s346744667 | p03846 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int i, j, zcnt = 0;
int N, a[100001], ncnt[100001] = {0};
int ans = 0;
bool flag = 0;
cin >> N;
for(i = 0; i < N; ++i){
cin >> a[i];
if(a[i] == 0) ++zcnt;
else ++ncnt[a[i]];
if(N % 2 == 1 && a[i] % 2 == 1) flag = 1;
else if(N % 2 == 0 && a[i] % 2 == 0) flag = 1;
}
if(N % 2 == 1 && zcnt != 1) flag = 1;
else if(N % 2 == 0 && zcnt != 0) flag = 1;
if(flag == 0){
if(N % 2 == 1){
for(i = 2; i < N; i+=2){
if(ncnt[i] == 2) ans += 2;
else{
flag = 1;
break;
}
}
}
else{
for(i = 1; i < N; i+=2){
if(ncnt[i] == 2) ans += 2;
else{
flag = 1;
break;
}
}
}
if(flag == 0) cout << pow(2, N/2) % (pow(10, 9) + 7) << endl;
}
if(flag == 1) cout << 0 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:40:51: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
40 | if(flag == 0) cout << pow(2, N/2) % (pow(10, 9) + 7) << endl;
| ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
| | |
| | __gnu_cxx::__promote<double>::__type {aka double}
| __gnu_cxx::__promote<double>::__type {aka double}
|
s837354578 | p03846 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int d[n];
int m;
for(int i = 0; i < n; i++) d[i] = 0;
for(int i = 0; i < n; i++){
cin >> m;
d[m]++;
// 同じ絶対値は2だけ
if(3 == d[m]){
cout << "0" << endl;
return 0;
}
// 偶数
if(0 == n % 2){
// Nが偶数の時は絶対値は必ず奇数
if(0 == m % 2){
cout << "0" << endl;
return 0;
}
// Nが偶数の時は必ず絶対値が0にならない
if(1 == d[0]){
cout << "0" << endl;
return 0;
}
}
// 奇数
else{
// Nが奇数の時は絶対値は必ず偶数
if(1 == m % 2){
cout << "0" << endl;
return 0;
}
// 絶対値0は必ず1つ
if(2 == d[0]){
cout << "0" << endl;
return 0;
}
}
}
double answer = 1;
double c = 1000000000 + 7;
for(int i = 0; i < (n / 2); i++){
answer *=2;
}
cout << int(answer % c) << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:73:22: error: invalid operands of types 'double' and 'double' to binary 'operator%'
73 | cout << int(answer % c) << endl;
| ~~~~~~ ^ ~
| | |
| double double
|
s742959759 | p03846 | Java | import java.util.Scanner;
public class LiningUp {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[sc.nextInt()]++;
}
for (int i = 0; i < n; i++) {
if (n % 2 == 0) {
if (i % 2 == 1 && a[i] != 2) {
System.out.println(0);
return;
}
} else {
if (i == 0 && a[i] != 1) {
System.out.println(0);
return;
} else if (i != 0 && i % 2 == 0 && a[i] != 2) {
System.out.println(0);
return;
}
}
}
System.out.println((long)Math.pow(2,(n / 2))%1000000007);
}
} | Main.java:3: error: class LiningUp is public, should be declared in a file named LiningUp.java
public class LiningUp {
^
1 error
|
s424850640 | p03846 | Java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[sc.nextInt()]++;
}
for (int i = 0; i < n; i++) {
if (n % 2 == 0) {
if (i % 2 == 1 && a[i] != 2) {
System.out.println(0);
return;
}
} else {
if (i == 0 && a[i] != 1) {
System.out.println(0);
return;
} else if (i != 0 && i % 2 == 0 && a[i] != 2) {
System.out.println(0);
return;
}
}
}
System.out.println((long)Math.pow(2,(n / 2))%1000000007);
}
| Main.java:31: error: reached end of file while parsing
}
^
1 error
|
s676908872 | p03846 | Java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[sc.nextInt()]++;
}
for (int i = 0; i < n; i++) {
if (n % 2 == 0) {
if (i % 2 == 1 && a[i] != 2) {
System.out.println(0);
return;
}
} else {
if (i == 0 && a[i] != 1) {
System.out.println(0);
return;
} else if (i != 0 && i % 2 == 0 && a[i] != 2) {
System.out.println(0);
return;
}
}
}
System.out.println((long)Math.pow(2,(n / 2))%1000000007);
}
| Main.java:31: error: reached end of file while parsing
}
^
1 error
|
s328699736 | p03846 | C++ | 8
7 5 1 1 7 3 5 3
| a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 8
| ^
|
s101978646 | p03846 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int d[n];
int m;
for(int i = 0; i < n; i++) d[i] = 0;
for(int i = 0; i < n; i++){
cin >> m;
d[m]++;
if(3 == d[m]){
cout << "0" << endl;
break;
}
// 偶数
if(0 == n % 2){
// Nが偶数の時は絶対値は必ず奇数
if(0 == m % 2){
cout << "0" << endl;
return 0;
}
// Nが偶数の時は必ず絶対値が0にならない
if(1 == d[0]){
cout << "0" << endl;
return 0;
}
}
// 奇数
else{
// Nが奇数の時は絶対値は必ず偶数
if(1 == m % 2){
cout << "0" << endl;
return 0;
}
// 絶対値0は必ず1つ
if(2 == d[0]){
cout << "0" << endl;
return 0;
}
}
}
unsigned int answer = 1;
unsigned int c = 1000000000 + 7
for(int i = 0; i < (n / 2); i++){
answer *=2;
}
cout << answer / c << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:69:3: error: expected ',' or ';' before 'for'
69 | for(int i = 0; i < (n / 2); i++){
| ^~~
a.cc:69:18: error: 'i' was not declared in this scope
69 | for(int i = 0; i < (n / 2); i++){
| ^
|
s235578879 | p03846 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int i, j, zcnt = 0, ans = 0;
int N, a[100001], ncnt[100001] = {0};
bool flag = 0;
cin >> N;
for(i = 0; i < N; ++i){
cin >> a[i];
if(a[i] == 0) ++zcnt;
else ++ncnt[a[i]];
if(a[i] >= N) flag = 1;
if(N % 2 == 1 && a[i] % 2 == 1) flag = 1;
else if(N % 2 == 0 && a[i] % 2 == 0) flag = 1;
}
if(N % 2 == 1 && zcnt != 1) flag = 1;
else if(N % 2 == 0 && zcnt != 0) flag = 1;
if(flag == 0){
if(N % 2 == 1){
for(i = 2; i < N; i+=2){
if(ncnt[i] == 2) ans += 2;
else{
flag = 1;
break;
}
}
}
else{
for(i = 1; i < N; i+=2){
if(ncnt[i] == 2) ans += 2;
else{
flag = 1;
break;
}
}
ans *= 2;
}
if(flag == 0) cout << ans % (pow(10, 9) + 7) << endl;
}
if(flag == 1) cout << 0 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:40:43: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
40 | if(flag == 0) cout << ans % (pow(10, 9) + 7) << endl;
| ~~~ ^ ~~~~~~~~~~~~~~~~
| | |
| int __gnu_cxx::__promote<double>::__type {aka double}
|
s363675498 | p03846 | C++ | 1#include <iostream>
#include <vector>
using namespace std;
const unsigned long long int MAX=1000000000+7;
int cnt[100001];
int main(){
int N;
cin>>N;
unsigned long long int total=1;
for(int i=0;i<N/2;i++) total*=2;
bool flag=true;
for(int i=0;i<N;i++){
int a;
cin>>a;
cnt[a]++;
if(N<=a) flag=false;
}
if(N%2==0){
if(cnt[0]>0) flag=false;
}else{
if(cnt[0]>1||cnt[0]==0) flag=false;
}
if(flag){
for(int i=0;i<=N;i++){
if(cnt[i]>2||(i!=0&&cnt[i]==1)){
flag=false;
break;
}
}
}
if(!flag){
cout<<'0'<<endl;
return 0;
}
cout<<total%MAX<<endl;
return 0;
}
| a.cc:1:2: error: stray '#' in program
1 | 1#include <iostream>
| ^
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1#include <iostream>
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argume |
s725647524 | p03846 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
long long cnt = 1;
int n;
bool v;
int b[100005];
void f(int p)
{
for(int i = 0; i < p; i++)
{
cnt = 2 * cnt % (1e9+7);
}
}
int main()
{
scanf("%d", &n);
for(int i = 0; i < n; i++)
{
int t;
scanf("%d", &t);
b[t]++;
}
if(b[(n + 1) % 2] != (n + 1) % 2 + 1)
{
v = true;
}
for(int i = (n + 1) % 2 + 2; i < n; i+=2)
{
if(b[i] != 2)v = true;
}
if(v)
{
printf("0");
return 0;
}
else
{
f(n / 2);
printf("%lld", cnt);
}
return 0;
}
| a.cc: In function 'void f(int)':
a.cc:15:23: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
15 | cnt = 2 * cnt % (1e9+7);
| ~~~~~~~ ^ ~~~~~~~
| | |
| | double
| long long int
|
s198087514 | p03846 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstdio>
#include <stack>
using namespace std;
#define rep(i,n) for (int i=0 ; i<(n);i++)
#define INF 1e9+7
int main(){
int n;
bool f = false;
cin >> n;
vector <int> a(n);
rep(i, n)
cin >> a[i];
sort(a.begin(), a.end());
if (n % 2) { //奇数
for (int i = 1; i < n / 2; i++)
if (a[2 * i-1] != a[2 * i])
f = true;
if (f)
cout << 0;
else
cout << (pow(2, a.size()/2))%1000000007;
}
else { //偶数
rep(i, n/2)
if (a[2 * i] != a[2 * i + 1])
f = true;
if (f)
cout << 0;
else
cout << (pow(2, a.size()/2))%1000000007;
}
} | a.cc: In function 'int main()':
a.cc:26:53: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
26 | cout << (pow(2, a.size()/2))%1000000007;
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
| | |
| | int
| __gnu_cxx::__promote<double>::__type {aka double}
a.cc:36:53: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
36 | cout << (pow(2, a.size()/2))%1000000007;
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
| | |
| | int
| __gnu_cxx::__promote<double>::__type {aka double}
|
s069102555 | p03847 | C++ | . | a.cc:1:1: error: expected unqualified-id before '.' token
1 | .
| ^
|
s017947702 | p03847 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
map<int,int>d;
inline int solve(int x){
if(d[x]!=0) return d[x];
else
return d[x]=((solve(x/2)+solve((x-1)/2)+solve((x-2)/2)))%mod;
}
signed main(){
d[0]=1;d[1]=2;
int n;
cin>>n;
n=read();
int ans=solve(n);
printf("%lld\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:15:11: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
15 | n=read();
| ~~~~^~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
from /usr/include/signal.h:328,
from /usr/include/c++/14/csignal:42,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
from a.cc:1:
/usr/include/unistd.h:371:16: note: declared here
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ^~~~
|
s439409084 | p03847 | C++ | #include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll m=1e9+7;
map<int,int>d;
ll p(l x){
if(d[x]!=0)return d[x];
else return d[x]=((p(x/2)+p((x-1)/2)+p((x-2)/2)))%m;
}
int main(){
d[0]=1;d[1]=2;
int n;
scanf ("%d",&n);
int ans=p(n);
printf("%lld\n",ans);
return 0;} | a.cc:6:6: error: 'l' was not declared in this scope
6 | ll p(l x){
| ^
a.cc: In function 'int main()':
a.cc:14:10: error: 'p' cannot be used as a function
14 | int ans=p(n);
| ~^~~
|
s275839451 | p03847 | C++ | #include<iostream>
#include<map>
using namespace std;
const long long mod=1e9+7;
map<long long,long long> d;
long long dx(long long x)
{
if(d[x]!=0){
return d[x];
}
else{
return d[x]=((solve(x>>1)+solve((x-1)>>1)+solve((x-2)>>!)))%mod;
}
}
int main()
{
d[0]=1;
d[1]=2;
long long n;
cin>>n;
cout<<dx(n)<<endl;
return 0;
} | a.cc: In function 'long long int dx(long long int)':
a.cc:12:23: error: 'solve' was not declared in this scope
12 | return d[x]=((solve(x>>1)+solve((x-1)>>1)+solve((x-2)>>!)))%mod;
| ^~~~~
a.cc:12:65: error: expected primary-expression before ')' token
12 | return d[x]=((solve(x>>1)+solve((x-1)>>1)+solve((x-2)>>!)))%mod;
| ^
|
s372770556 | p03847 | C++ | #include<iostream>
#include<map>
using namespace std;
const long long mod=1e9+7;
map<long long,long long> d;
long long dx(long long n)
{
if(d[x]!=0){
return d[x];
}
else{
return d[x]=((solve(x>>1)+solve((x-1)>>1)+solve((x-2)>>!)))%mod;
}
}
int main()
{
d[0]=1;
d[1]=2;
long long n;
cin>>n;
cout<<dx(n)<<endl;
return 0;
} | a.cc: In function 'long long int dx(long long int)':
a.cc:8:10: error: 'x' was not declared in this scope
8 | if(d[x]!=0){
| ^
a.cc:12:23: error: 'solve' was not declared in this scope
12 | return d[x]=((solve(x>>1)+solve((x-1)>>1)+solve((x-2)>>!)))%mod;
| ^~~~~
a.cc:12:65: error: expected primary-expression before ')' token
12 | return d[x]=((solve(x>>1)+solve((x-1)>>1)+solve((x-2)>>!)))%mod;
| ^
|
s717421787 | p03847 | C++ | #include<bits/stdc++.h>
#define ll long long
using namespace std;
map<ll,ll>dp;
ll mod=1e9+7;
ll f(ll x)
{
if(x==0)return dp[0]=1;
else if(x==1)return dp[1]=2;
else if(dp[x])return dp[x];
else
{
return dp[x]=(f(x/2)+f((x-1)/2)+f((x-2)/2))%mod;
}
}
int main()
{
ll x;
cin>>x;
cout<<f(x)<<endl;
}
————————————————
版权声明:本文为CSDN博主「凌晨四点的洛杉矶fly」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_40859951/article/details/90612148 | a.cc:22:1: error: extended character — is not valid in an identifier
22 | ————————————————
| ^
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:22:1: error: extended character — is not valid in an identifier
a.cc:23:1: error: extended character 「 is not valid in an identifier
23 | 版权声明:本文为CSDN博主「凌晨四点的洛杉矶fly」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
| ^
a.cc:23:1: error: extended character 」 is not valid in an identifier
a.cc:23:78: error: extended character 。 is not valid in an identifier
23 | 版权声明:本文为CSDN博主「凌晨四点的洛杉矶fly」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
| ^
a.cc:22:1: error: '\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014' does not name a type
22 | ————————————————
| ^~~~~~~~~~~~~~~~
|
s601762718 | p03847 | C++ | // luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
map<int,int>d;
inline int read()
{
char ch=getchar();
int x=0,q=1;
while(ch>'9' || ch<'0')q=ch==45?-1:q,ch=getchar();
while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^'0'),ch=getchar();
return x*q;
}
inline int solve(int x)/
{
if(d[x]!=0)
return d[x];
else
return d[x]=((solve(x/2)+solve((x-1)/2)+solve((x-2)/2)))%mod;
}
signed main()
{
d[0]=1;
d[1]=2;
int n;
n=read();
int ans=solve(n);
printf("%lld\n",ans);
return 0;
} | a.cc:15:24: error: expected initializer before '/' token
15 | inline int solve(int x)/
| ^
a.cc: In function 'int main()':
a.cc:28:13: error: 'solve' was not declared in this scope
28 | int ans=solve(n);
| ^~~~~
|
s987703685 | p03847 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
map<int,int>d;
inline int read() {
char ch=getchar();
int x=0,q=1;
while(ch>'9' || ch<'0')q=ch==45?-1:q,ch=getchar();
while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^'0'),ch=getchar();
return x*q;
}
inline int solve(int x) {
if(d[x]!=0)
return d[x];
else
return d[x]=((solve(x/2)+solve((x-1)/2)+solve((x-2)/2)))%mod;
}
int main() {
d[0]=1;
d[1]=2;
int n;
n=read();
int ans=solve(n);
printf("%lld\n",ans);
return 0;
} | cc1plus: error: '::main' must return 'int'
|
s084681341 | p03847 | C++ | #include<cstdio>
using namespace std;
int n,m,sum1,sum2,a[110],p,x;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
sum1+=a[i];
}
scanf("%d",&m);
sum2=sum1;
while(m--)
{
scanf("%d%d",&p,&x);
if(x>=a[p-1]) sum1+=x-a[p-1];拟
else sum1-=a[p-1]-x;
printf("%d\n",sum1);
sum1=sum2;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:38: error: '\U000062df' was not declared in this scope
17 | if(x>=a[p-1]) sum1+=x-a[p-1];拟
| ^~
|
s546262719 | p03847 | C++ | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
typedef __int64 ll;
const int INF = 1<<30;
const int MAXN = (int) 7e6+11;
const int MAX_SIZE = 40;
struct Node {
ll val;
int ch[2];
} Trie[MAXN];
int use;
ll S[MAX_SIZE];
int n, m;
int New() {
Trie[use].val = Trie[use].ch[0] = Trie[use].ch[1] = 0;
return use++;
}
inline void change(ll x) {
for (int i = MAX_SIZE-1; i >= 0; i--) {
S[i] = x&1;
x >>= 1;
}
}
void insert(ll x) {
change(x);
int p = 0;
for (int i = 0; i < MAX_SIZE; i++) {
if (!Trie[p].ch[S[i]]) Trie[p].ch[S[i]] = New();
p = Trie[p].ch[S[i]];
}
Trie[p].val = x;
}
ll find(ll x) {
change(x);
int p = 0;
for (int i = 0; i < MAX_SIZE; i++) {
int now;
if (Trie[p].ch[S[i]^1]) p = Trie[p].ch[S[i]^1];
else p = Trie[p].ch[S[i]];
}
return Trie[p].val;
}
int main() {
int T;
scanf("%d", &T);
for (int Case = 1; Case <= T; Case++) {
printf("Case #%d:\n", Case);
use = 0;
New();
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
ll x;
scanf("%I64d", &x);
insert(x);
}
for (int i = 0; i < m; i++) {
ll x;
scanf("%I64d", &x);
printf("%I64d\n", find(x));
}
}
return 0;
} | a.cc:5:9: error: '__int64' does not name a type; did you mean '__int64_t'?
5 | typedef __int64 ll;
| ^~~~~~~
| __int64_t
a.cc:10:9: error: 'll' does not name a type
10 | ll val;
| ^~
a.cc:14:1: error: 'll' does not name a type
14 | ll S[MAX_SIZE];
| ^~
a.cc: In function 'int New()':
a.cc:17:19: error: 'struct Node' has no member named 'val'
17 | Trie[use].val = Trie[use].ch[0] = Trie[use].ch[1] = 0;
| ^~~
a.cc: At global scope:
a.cc:20:13: error: variable or field 'change' declared void
20 | inline void change(ll x) {
| ^~~~~~
a.cc:20:20: error: 'll' was not declared in this scope
20 | inline void change(ll x) {
| ^~
a.cc:26:6: error: variable or field 'insert' declared void
26 | void insert(ll x) {
| ^~~~~~
a.cc:26:13: error: 'll' was not declared in this scope
26 | void insert(ll x) {
| ^~
a.cc:36:1: error: 'll' does not name a type
36 | ll find(ll x) {
| ^~
a.cc: In function 'int main()':
a.cc:55:25: error: 'll' was not declared in this scope
55 | ll x;
| ^~
a.cc:56:41: error: 'x' was not declared in this scope
56 | scanf("%I64d", &x);
| ^
a.cc:57:25: error: 'insert' was not declared in this scope
57 | insert(x);
| ^~~~~~
a.cc:60:25: error: 'll' was not declared in this scope
60 | ll x;
| ^~
a.cc:61:41: error: 'x' was not declared in this scope
61 | scanf("%I64d", &x);
| ^
|
s656418502 | p03847 | C++ | #include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#define mm(i,v) memset(i,v,sizeof i);
using namespace std;
typedef long long ll;
const int mod=1e9+7;
//map<ll,ll> v;
ll f(int x){
if(x==0)
return 1;
if(x==1)
return 2;
return f(x/2)+f((x-1)/2)+f((x-2)/2)%mod;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
v[0]=1;
v[1]=2;
ll n;
cin>>n;
cout<<f(n)<<"\n";
return 0;
}
| a.cc: In function 'int main()':
a.cc:29:9: error: 'v' was not declared in this scope
29 | v[0]=1;
| ^
|
s970216712 | p03847 | C++ | #include<map>
#include<iostream>
using namespace std;
typedef unsigned long long inter;
const inter m=1e9+7;
map<inter,inter> dick;
inter f(inter x)
{
if(dick[x])
return dick[x];
else
return dick[x]=((f(x/2)+f((x-1)/2)+f((x-2)/2)))%m;
}
int main()
{
dick[0]=1;
dick[1]=2;
inter n;
cin>>n;
cout<<f(n);
work();
} | a.cc: In function 'int main()':
a.cc:22:5: error: 'work' was not declared in this scope
22 | work();
| ^~~~
|
s372326653 | p03847 | C++ | #include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
map<long long,long long>dp;
long long Dp(long long x)
{
if(dp[x])
return dp[x];
else
return dp[x]=((Dp[x/2])+Dp[(x-1)/2]+Dp[(x-2)/2])%mod;
}
int main(){
Dp[0]=1;
Dp[1]=2;
long long n;
cin>>n;
cout<<Dp[n];
return 0;
} | a.cc: In function 'long long int Dp(long long int)':
a.cc:10:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
10 | return dp[x]=((Dp[x/2])+Dp[(x-1)/2]+Dp[(x-2)/2])%mod;
| ^
a.cc:10:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
10 | return dp[x]=((Dp[x/2])+Dp[(x-1)/2]+Dp[(x-2)/2])%mod;
| ^
a.cc:10:32: error: invalid operands of types 'long long int(long long int)' and 'long long int(long long int)' to binary 'operator+'
10 | return dp[x]=((Dp[x/2])+Dp[(x-1)/2]+Dp[(x-2)/2])%mod;
| ~~~~~~~~~^~~~~~~~~~~~
| | |
| | long long int(long long int)
| long long int(long long int)
a.cc:10:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
10 | return dp[x]=((Dp[x/2])+Dp[(x-1)/2]+Dp[(x-2)/2])%mod;
| ^
a.cc: In function 'int main()':
a.cc:13:13: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | Dp[0]=1;
| ^
a.cc:13:14: error: assignment of read-only location '* Dp'
13 | Dp[0]=1;
| ~~~~~^~
a.cc:14:13: warning: pointer to a function used in arithmetic [-Wpointer-arith]
14 | Dp[1]=2;
| ^
a.cc:14:14: error: assignment of read-only location '*(Dp + 1)'
14 | Dp[1]=2;
| ~~~~~^~
a.cc:17:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
17 | cout<<Dp[n];
| ^
|
s942824415 | p03847 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
map<int,int>f;
inline int read()
{
char ch=getchar();
int x=0,q=1;
while(ch>'9' || ch<'0')q=ch==45?-1:q,ch=getchar();
while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^'0'),ch=getchar();
return x*q;
}
inline int solve(int k)
{
if(f[k]!=0) return f[k];
else
return f[k]=((solve(k/2)+solve((k-1)/2)+solve((k-2)/2)))%mod;
}
int main()
{
f[0]=1;
f[1]=2;
int n;
n=read();
int ans=solve(n);
printf("%lld\n",ans);
return 0;
} | cc1plus: error: '::main' must return 'int'
|
s546105949 | p03847 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
map<int,int>f;
inline int read()
{
char ch=getchar();
int x=0,q=1;
while(ch>'9' || ch<'0')q=ch==45?-1:q,ch=getchar();
while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^'0'),ch=getchar();
return x*q;
}
inline int solve(int k)
{
if(f[k]!=0) return f[k];
else
return f[k]=((solve(k/2)+solve((k-1)/2)+solve((k-2)/2)))%mod;
}
int main()
{
f[0]=1;
f[1]=2;
int n;
n=read();
int ans=solve(n);
printf("%lld\n",ans);
return 0;
} | cc1plus: error: '::main' must return 'int'
|
s913832465 | p03847 | C++ | #include<bits/stdc++.h>
using namespace std;
long long f[2000000001];
long long n;
long long ans;
long long s=1000000007;
inline int read()
{
char ch=getchar();
int x=0,q=1;
while(ch>'9' || ch<'0')q=ch==45?-1:q,ch=getchar();
while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^'0'),ch=getchar();
return x*q;
}
inline int shulun(int k)
{
if(f[k]!=0)
{
return f[k];
}
else
{
return f[k]=((shulun(k/2)+shulun((k-1)/2)+shulun((k-2)/2)))%s;
}
}
signed main()
{
f[0]=1;
f[1]=2;
n=read();
ans=shulun(n);
printf("%d\n",ans);
return 0;
} | /tmp/ccY6SglS.o: in function `main':
a.cc:(.text+0x24): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccY6SglS.o
a.cc:(.text+0x2b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccY6SglS.o
a.cc:(.text+0x3b): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccY6SglS.o
a.cc:(.text+0x42): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccY6SglS.o
collect2: error: ld returned 1 exit status
|
s020804627 | p03847 | C++ | #include<bits/stdc++.h>
using namespace std;
long long n;
int dfs(u){
if(u==1) return 2;
if(u==2) return 4;//+2
if(u==3) return 5;//+1
if(u==4) return 8;//+3
if(u==5) return 10;//+2
if(u==6) return 13;//+3
if(u==7) return 14;//+1
if(u==8) return 18;//+4
if(u==9) return 21;//+3
if(u==10) return 26;//+5
}
int main(){
scanf("%d",&n);
int m=dfs(n);
printf("%d",m);
return 0;
} | a.cc:4:9: error: 'u' was not declared in this scope
4 | int dfs(u){
| ^
a.cc: In function 'int main()':
a.cc:18:18: error: 'dfs' cannot be used as a function
18 | int m=dfs(n);
| ~~~^~~
|
s001592419 | p03847 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
map<int,int>d;
inline int read()
{
char ch=getchar();
int x=0,q=1;
while(ch>'9' || ch<'0')q=ch==45?-1:q,ch=getchar();
while(ch>='0' && ch<='9')x=(x<<1)+(x<<3)+(ch^'0'),ch=getchar();
return x*q;
}
inline int solve(int x)
{
if(d[x])
return d[x];
else
return d[x]=((solve(x/2)+solve((x-1)/2)+solve((x-2)/2)))%mod;
}
signed main()
{
//初始条件
d[0]=1;//a=b=0一组
d[1]=2; //a=b=0一组 ,a=b=1第二组;
int n;
n=read();
int ans=solve(n);
printf("%lld\n",ans)
return 0;
| a.cc: In function 'int main()':
a.cc:29:29: error: expected ';' before 'return'
29 | printf("%lld\n",ans)
| ^
| ;
30 | return 0;
| ~~~~~~
a.cc:30:18: error: expected '}' at end of input
30 | return 0;
| ^
a.cc:22:1: note: to match this '{'
22 | {
| ^
|
s304559762 | p03847 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;
typedef priority_queue<PP, vector<PP>, greater<PP>> PPQueue;
#define fi first
#define se second
#define sfi se.fi
#define sse se.se
#define pb push_back
#define INF INT_MAX
#define MOD 1000000007
#define bcnt __builtin_popcount
#define all(x) (x).begin(),(x).end()
#define uni(x) x.erase(unique(all(x)),x.end())
#define ub(x,y) (upper_bound(all(x),y)-x.begin())
#define lb(x,y) (lower_bound(all(x),y)-x.begin())
#define rep(i,n) repl(i,0,n-1)
#define usort(x) sort(all(x))
#define dsort(x) sort(all(x),greater<ll>())
#define mkp(x,y) make_pair(x,y)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define exist(x,y) (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)
map<P,ll> memp;
ll f(ll s, ll x) {
P m(s,x);
if(memo.count(m))return memo[m];
if(s == 0)return 1;
memo[m] = f(s/2, x/2) + f((s-1)/2, (x^1)/2) % MOD;
if(s >= 2) memo[m] += f((s-2)/2, x/2);
return memo[m] %= MOD;
}
int main() {
cin.sync_with_stdio(false);
ll n;
cin >> n;
cout << f(n, n) << endl;
}
| a.cc: In function 'll f(ll, ll)':
a.cc:39:6: error: 'memo' was not declared in this scope; did you mean 'memp'?
39 | if(memo.count(m))return memo[m];
| ^~~~
| memp
a.cc:41:3: error: 'memo' was not declared in this scope; did you mean 'memp'?
41 | memo[m] = f(s/2, x/2) + f((s-1)/2, (x^1)/2) % MOD;
| ^~~~
| memp
|
s142887540 | p03847 | C++ | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
final long N = sc.nextLong();
long cnt = 0;
long u, v, a, x;
for(u = 0; u <= N; u++) {
for(v = u; v <= N; v++) {
for(a = 0; a <= v / 2; a++) {
x = a ^ v - a;
if(x == u) {
cnt++;
break;
}
}
}
}
cnt = cnt % (1000000000 + 7);
System.out.println(cnt);
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s102273567 | p03847 | C++ | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//final long N = sc.nextLong();
final long N = 1000000000000000000l;
long cnt = 0;
long u, v, a, x;
for(u = 0; u <= N; u++) {
for(v = u; v <= N; v++) {
for(a = 0; a <= v / 2; a++) {
x = a ^ v - a;
if(x == u) {
cnt++;
break;
}
}
}
}
cnt = cnt % (1000000000 + 7);
System.out.println(cnt);
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s770668295 | p03847 | C++ | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//final long N = sc.nextLong();
final long N = 1000000000000000000l;
long cnt = 0;
long u, v, a, x;
for(u = 0; u <= N; u++) {
for(v = u; v <= N; v++) {
for(a = 0; a <= v / 2; a++) {
x = a ^ v - a;
if(x == u) {
cnt++;
break;
}
}
}
}
cnt = cnt % (1000000000 + 7);
System.out.println(cnt);
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s008133434 | p03847 | C++ | #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <unordered_set>
//#include <unordered_map>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define f first
#define s second
using namespace std;
typedef long double ld;
typedef long long ll;
const ld PI = acos(-1);
const ld EPS = 1e-6;
const int MOD = (int)1e9 + 7;
const int N = (int)2e5 + 7;
int n;
ll a[66][2][3];
int d[66];
ll call(int len){
for(int i = 1; i <= len; i++)
for(int p = 0; p <= 1; p++)
for(int q = 0; q <= 1; q++)
for(int a = 0; a <= 1; a++)
for(int b = a; b <= 1; b++){
int nq = a + b + q > 1 ? 1 : 0;
int now = (a + b + q) & 1;
int np = ((now > d[i]) || (p && now == d[i])) ? 1 : 0;
dp[i][np][nq] += dp[i-1][p][q];
dp[i][np][nq] %= MOD;
}
return dp[len][0][0];
}
int main() {
int t;
ll num;
scanf("%d", &t);
while (t--) {
int bit = 0;
d[0] = 0;
dp[0][0][0] = 1;
scanf("%d", &num);
while(num){
d[bit++] = num & 1;
num >>= 1;
}
printf("%d\n", call(bit));
}
}
| a.cc: In function 'll call(int)':
a.cc:59:5: error: 'dp' was not declared in this scope; did you mean 'np'?
59 | dp[i][np][nq] += dp[i-1][p][q];
| ^~
| np
a.cc:62:10: error: 'dp' was not declared in this scope; did you mean 'd'?
62 | return dp[len][0][0];
| ^~
| d
a.cc: In function 'int main()':
a.cc:72:5: error: 'dp' was not declared in this scope; did you mean 'd'?
72 | dp[0][0][0] = 1;
| ^~
| d
|
s179200047 | p03847 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll MOD = 1e9 + 7;
map<pll, ll> dp;
ll f(ll s, ll x) {
if (dp.count(pll(s, x))) return dp[pll(s, x)];
if (s == 0 && x == 0) return 1;
ll res = f(s/2, x/2) % MOD;
if (s >= 1 && x >= 1) {
res = (res + f((s-1)/2, (x-1)/2)) % MOD;
}
if (s >= 2) {
res = (res + f((s-2)/2, x/2)) % MOD;
}
return dp[pll(s, x)] = res;
}
main() {
ll N;
cin >> N;
cout << f(N, N) << endl;
}
| a.cc:28:1: error: extended character is not valid in an identifier
28 |
| ^
a.cc:23:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
23 | main() {
| ^~~~
a.cc:28:1: error: '\U000000a0' does not name a type
28 |
| ^
|
s694781805 | p03847 | C++ | #include <stdio.h>
#include <iostream>
#include <map>
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const LL mod=1e9 + 7;
map<LL, LL> mp;
/*
int dp[N];
bool check[N];
*/
LL dfs(LL N){
if(N==0) return 1;
if(N==1) return 2;
if(mp[N] > 0) return mp[N];
return mp[N] = (dfs(N/2) + dfs((N-1)/2) + dfs((N-2)/2) % mod;
}
int main(void){
LL N = 0;
cin >> N;
cout << dfs(N) << endl;
return 0;
} | a.cc: In function 'long long int dfs(long long int)':
a.cc:22:65: error: expected ')' before ';' token
22 | return mp[N] = (dfs(N/2) + dfs((N-1)/2) + dfs((N-2)/2) % mod;
| ~ ^
| )
|
s793140669 | p03847 | C++ | #include <iostream>
using namespace std;
int main()
{
int N;
int b;
int uuu;
long MOD = pow(10,9) + 7;
long cnt = 0;
cin >> N;
for(int uu=0;uu<=N;uu++)
{
for(int vv=0;vv<=N;vv++)
{
for(int a=0;a<=vv;a++)
{
b = vv-a; //a+b=vv
uuu = a^b;
if(b >= 0 && uuu == uu)
{
cerr << uu << vv << a << b<<endl;
cnt++;
break;
}
}
}
}
cout << cnt % MOD << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:20: error: 'pow' was not declared in this scope
10 | long MOD = pow(10,9) + 7;
| ^~~
|
s822821276 | p03848 | C++ | #include <iostream>
using namespace std;
int main(){
int N, flg = 0;
long long ans = 1, t = 1000000007;
cin >> N;
int A[N];
for (int i = 0; i < N; i++){
cin >> A[i];
}
sort(A, A+N);
if (N%2 == 0){
for (int i = 0; i < N; i+=2){
if(A[i]!=i+1 || A[i+1]!=i+1){
flg = 1;
break;
}
}
}else{
if (A[0] != 0){
flg = 1;
}else{
for (int i = 1; i < N; i+=2){
if(A[i]!=i+1 || A[i+1]!=i+1){
flg = 1;
break;
}
}
}
}
if (flg==1){
printf("0\n");
}else{
for (int i=0; i < N/2; i++){
ans *= 2;
ans %= t;
}
printf("%llu\n",ans);
}
}
| a.cc: In function 'int main()':
a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'?
14 | sort(A, A+N);
| ^~~~
| short
|
s199588447 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}
// nのk乗を計算する
ll modpow(ll n, ll k){
ll ret = 1;
ll t = n;
while(k > 0){
if(k & 1) ret = ret * t % MOD;
t = t * t % MOD;
k = k>>1;
}
return ret;
}
int main(){
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; i++) {
cin >> a[i];
}
sort(ALL(a));
bool check;
if(N % 2 == 0){
check = true;
for (int i = 0; i < N; i++) {
if(a[i] != 2*(i/2) + 1){
check = false;
}
}
}
else{
check = true;
for (int i = 0; i < N; i++) {
if(a[i] != 2*((i+1)/2)){
check = false;
}
}
}
if(check == false){
printf("0\n");
return 0;
}
ll ans = modpow(2, n/2);
printf("%lld\n", ans);
} | a.cc: In function 'int main()':
a.cc:62:24: error: 'n' was not declared in this scope
62 | ll ans = modpow(2, n/2);
| ^
|
s242530770 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, m, a[maxn];
multiset<int, greater<int>> prices;
int32_t main()
{
cin >> n >> m;
for(int i = 0; i < n; i++)
{
cin >> a;
prices.insert(a);
}
for(int i = 0; i < m; i++)
{
int largest = *prices.begin();
prices.erase(prices.begin());
prices.insert(largest / 2);
}
long long ans = 0;
for(auto x : prices)
ans += x;
cout << ans << "\n";
return 0;
} | a.cc: In function 'int32_t main()':
a.cc:13:13: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [100005]')
13 | cin >> a;
| ~~~ ^~ ~
| | |
| | int [100005]
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:16: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*'
13 | cin >> a;
| ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:16: error: invalid conversion from 'int*' to 'short int' [-fpermissive]
13 | cin >> a;
| ^
| |
| int*
a.cc:13:16: error: cannot bind rvalue '(short int)((int*)(& a))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:16: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive]
13 | cin >> a;
| ^
| |
| int*
a.cc:13:16: error: cannot bind rvalue '(short unsigned int)((int*)(& a))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:16: error: invalid conversion from 'int*' to 'int' [-fpermissive]
13 | cin >> a;
| ^
| |
| int*
a.cc:13:16: error: cannot bind rvalue '(int)((int*)(& a))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:16: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive]
13 | cin >> a;
| ^
| |
| int*
a.cc:13:16: error: cannot bind rvalue '(unsigned int)((int*)(& a))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:16: error: invalid conversion from 'int*' to 'long int' [-fpermissive]
13 | cin >> a;
| ^
| |
| int*
a.cc:13:16: error: cannot bind rvalue '(long int)((int*)(& a))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:16: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive]
13 | cin >> a;
| ^
| |
| int*
a.cc:13:16: error: cannot bind rvalue '(long unsigned int)((int*)(& a))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:16: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
13 | cin >> a;
| ^
| |
| int*
a.cc:13:16: error: cannot bind rvalue '(long long int)((int*)(& a))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:16: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive]
13 | cin >> a;
| ^
| |
| int*
a.cc:13:16: error: cannot bind rvalue '(long long unsigned int)((int*)(& a))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:13:16: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
13 | cin >> a;
| ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'int [100005]' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'int [100005]' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'int [100005]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'int [100005]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'int [100005]' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_typ |
s205792159 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
int N;
cin >> N;
vector<int>A(N);
map<int,int>Mp;
for(int i = 0; i < N; i++) {
cin >> A[i];
Mp[A[i]]++;
}
if(N%2 == 0) {
// o o o o o o
// 5 3 1 1 3 5
for(int i = 1; i < N; i+=2) {
if(Mp[i] != 2) {
cout << 0 << endl;
return 0;
}
}
cout << pow(2,N/2)%INF << endl;
}
else {
// o o o o o
// 4 2 0 2 4
for(int i = 0; i < N; i+=2) {
if(i == 0) {
if(Mp[i] != 1) {
cout << 0 << endl;
return 0;
}
}
else if(Mp[i] != 2) {
cout << 0 << endl;
return 0;
}
}
cout << pow(2,(N-1)/2)%INF << endl;
}
}
| a.cc: In function 'int main()':
a.cc:27:27: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
27 | cout << pow(2,N/2)%INF << endl;
| ~~~~~~~~~~^~~~
| | |
| | long long int
| __gnu_cxx::__promote<double>::__type {aka double}
a.cc:44:31: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
44 | cout << pow(2,(N-1)/2)%INF << endl;
| ~~~~~~~~~~~~~~^~~~
| | |
| | long long int
| __gnu_cxx::__promote<double>::__type {aka double}
|
s355563119 | p03848 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const double pi=acos(-1);
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator - () const noexcept {
return val ? MOD - val : 0;
}
constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
constexpr Fp& operator += (const Fp& r) noexcept {
val += r.val;
if (val >= MOD) val -= MOD;
return *this;
}
constexpr Fp& operator -= (const Fp& r) noexcept {
val -= r.val;
if (val < 0) val += MOD;
return *this;
}
constexpr Fp& operator *= (const Fp& r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp& operator /= (const Fp& r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
val = val * u % MOD;
if (val < 0) val += MOD;
return *this;
}
constexpr bool operator == (const Fp& r) const noexcept {
return this->val == r.val;
}
constexpr bool operator != (const Fp& r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0) return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1) t = t * a;
return t;
}
};
using mint = Fp<MOD>;
mint calc(long long N, long long K) {
mint res = 1;
for (long long n = 0; n < K; ++n) {
res *= (N - n);
res /= (n + 1);
}
return res;
}
int main() {
//cout << fixed << setprecision(12);
ll n;
cin>>n;
ll m[n];
ll r=0;
ll ca=0;
for(ll i=0; i<n; i++){
cin>>r;
m[r]++;}
if(n==1){
if(m[0]==0) cout << 1 << endl;
else cout << 0 << endl;}
else{
if(n%2==0){
for(ll i=1; i<n; i=i+2){
if(m[i]!=2){ ca++;
break;}}
if(ca==1) cout << 0 << endl;
else{
ll ans = pow(2,n/2);
cout << ans << endl;}}
else{
for(ll i=2; i<n; i+=2){
if(m[i]!=2){ ca++, break;}
}
if(ca==1) cout << 0 << endl;
else{
ll ans = pow(2,n/2);
cout << ans << endl;}}}} | a.cc: In function 'int main()':
a.cc:112:20: error: expected primary-expression before 'break'
112 | if(m[i]!=2){ ca++, break;}
| ^~~~~
|
s312165232 | p03848 | C++ | #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
const int m=1000000007;
int main(){
int n;
cin >> n;
vi a(n);
rep(i,n) cin >> a[i];
sort(a.begin(),a.end());
int f=n%2;
ll ans=1;
if(f==1){
if(a[0]!=0){cout << 0;return 0;}
for(int i=1;i<n;i++){
if(a[i]!=(i+1)/2*2){cout << 0;return 0;}
}
rep(i,(n-1)/2){ans*=2;ans%=m}
cout << ans;
}else{
for(int i=0;i<n;i++){
if(a[i]!=i/2*2+1){cout << 0;return 0;}
}
rep(i,n/2){ans*=2;ans%=m}
cout << ans;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:33: error: expected ';' before '}' token
23 | rep(i,(n-1)/2){ans*=2;ans%=m}
| ^
| ;
a.cc:29:29: error: expected ';' before '}' token
29 | rep(i,n/2){ans*=2;ans%=m}
| ^
| ;
|
s540829617 | p03848 | C++ | #include<bits/stdc++.h>
using anemspace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
for(auto& ai:a)cin>>ai;
map<int,int64_t> mp;
for(auto const& ai:a)mp[ai]++;
constexpr int64_t mod = 1e9+7;
if(n&1){
bool ok = true;
if(mp[0]!=1)ok=false;
for(auto& [k,v]:mp){
if(k%2!=0)ok=false;
if(k!=0&&v!=2)ok=false;
}
if(!ok){cout<<0<<endl;return 0;}
int64_t ans = 1;
for(int i=0;i<n/2;++i)(ans*=2)%=mod;
cout<<ans<<endl;
}
else{
bool ok = true;
for(auto& [k,v]:mp){
if(k%2==0)ok=false;
if(v!=2)ok=false;
}
if(!ok){cout<<0<<endl;return 0;}
int64_t ans = 1;
for(int i=0;i<n/2;++i)(ans*=2)%=mod;
cout<<ans<<endl;
}
} | a.cc:2:7: error: expected nested-name-specifier before 'anemspace'
2 | using anemspace std;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin>>n;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
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:6:3: error: 'vector' was not declared in this scope
6 | vector<int> a(n);
| ^~~~~~
a.cc:6: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:
/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:6:10: error: expected primary-expression before 'int'
6 | vector<int> a(n);
| ^~~
a.cc:7:16: error: 'a' was not declared in this scope; did you mean 'ai'?
7 | for(auto& ai:a)cin>>ai;
| ^
| ai
a.cc:9:3: error: 'map' was not declared in this scope
9 | map<int,int64_t> mp;
| ^~~
a.cc:9:3: note: suggested alternatives:
In file included from /usr/include/c++/14/map:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152:
/usr/include/c++/14/bits/stl_map.h:102:11: note: 'std::map'
102 | class map
| ^~~
/usr/include/c++/14/map:89:13: note: 'std::pmr::map'
89 | using map
| ^~~
a.cc:9:7: error: expected primary-expression before 'int'
9 | map<int,int64_t> mp;
| ^~~
a.cc:10:22: error: 'a' was not declared in this scope; did you mean 'ai'?
10 | for(auto const& ai:a)mp[ai]++;
| ^
| ai
a.cc:10:24: error: 'mp' was not declared in this scope
10 | for(auto const& ai:a)mp[ai]++;
| ^~
a.cc:16:8: error: 'mp' was not declared in this scope
16 | if(mp[0]!=1)ok=false;
| ^~
a.cc:17:21: error: 'mp' was not declared in this scope
17 | for(auto& [k,v]:mp){
| ^~
a.cc:21:13: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
21 | if(!ok){cout<<0<<endl;return 0;}
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:21:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
21 | if(!ok){cout<<0<<endl;return 0;}
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:24:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
24 | 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:24:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
24 | cout<<ans<<endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:28:21: error: 'mp' was not declared in this scope
28 | for(auto& [k,v]:mp){
| ^~
a.cc:32:13: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
32 | if(!ok){cout<<0<<endl;return 0;}
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:32:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
32 | if(!ok){cout<<0<<endl;return 0;}
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:35:5: 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:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
35 | cout<<ans<<endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s351446194 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;
//繰り返し二乗法
ll EX(ll x,ll n){
if(n == 0) return 1;
else if(n%2 == 1) return EX(x,n-1)*x%mod;
else return EX(x*x%mod,n/2)%mod;
};
int main(){
ll n;
cin >> n;
vector<ll> a(n);
ll tmp = n/2+1;
vector<ll> mp(tmp,0);
for(ll i = 0; i < n; i++){
cin >> a[i];
mp[a[i]]++;
}
/*bool end = false;
if(mp[0] != 1 && n%2 == 1) end = true;
else if(mp[0] != 0 && n%2 == 0) end = true;
for(ll i = 1; i < tmp; i++){
if(mp[i] != 2 && mp[i] != 0) end = true;
}*/
if(end){
cout << 0 << endl;
return 0;
}
cout << EX(2,n/2) << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:29:11: error: cannot resolve overloaded function 'end' based on conversion to type 'bool'
29 | if(end){
| ^
|
s413852447 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll MOD = 10 ** 9 + 7;
int main() {
} | a.cc:6:14: error: invalid type argument of unary '*' (have 'int')
6 | ll MOD = 10 ** 9 + 7;
| ^~~
|
s254106046 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ll modpow(ll n,ll a){
if(a==0){
return 0;
}
else if(a%2==0){
ll t=modpow(n,a/2);
return t*t%MOD;
}
else
return n*modpow(n,a-1)%MOD;
}
int main() {
ll n;
cin >> n;
vl a(n);
vl cnt(n);
rep(i,n){
cin >> a[i];
ll cnt[a[i]]++;
}
bool B=false;
ll i=n-1;
while(i>=0){
if(i!=0&&cnt[i]!=2){
B=true;
}
if(i==0&&cnt[i]!=1){
B=true;
}
i -=2
}
if(B){
cout << 0 << endl;
}
else{
cout << modpow(2,n/2) << endl;
}
}
| a.cc: In function 'int main()':
a.cc:34:17: error: expected initializer before '++' token
34 | ll cnt[a[i]]++;
| ^~
a.cc:45:10: error: expected ';' before '}' token
45 | i -=2
| ^
| ;
46 | }
| ~
|
s544669328 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ll modpow(ll n,ll a){
if(a==0){
return 0;
}
else if(a%2==0){
ll t=modpow(n,a/2);
return t*t%MOD;
}
else
return n*modpow(n,a-1)%MDO;
}
int main() {
ll n;
cin >> n;
vl a(n);
vl cnt(n);
rep(i,n){
cin >> a[i];
ll cnt[a[i]]++;
}
bool B=false;
ll i=n-1;
while(i>=0){
if(i!=0&&cnt[i]!=2){
B=true;
}
if(i==0&&cnt[i]!=1){
B=true;
}
i -=2
}
if(B){
cout << 0 << endl;
}
else{
cout << modpow(2,n/2) << endl;
}
} | a.cc: In function 'll modpow(ll, ll)':
a.cc:24:28: error: 'MDO' was not declared in this scope; did you mean 'MOD'?
24 | return n*modpow(n,a-1)%MDO;
| ^~~
| MOD
a.cc: In function 'int main()':
a.cc:34:17: error: expected initializer before '++' token
34 | ll cnt[a[i]]++;
| ^~
a.cc:45:10: error: expected ';' before '}' token
45 | i -=2
| ^
| ;
46 | }
| ~
|
s453390513 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ll modpow(ll n,ll a){
if(a==0){
return 0;
}
else if(a%2==0){
ll t=modpow(n,a/2);
return t*t%MOD;
}
else
return n*modpow(n,a-1)%MDO;
}
int main() {
ll n;
cin >> n;
vl a(n);
vl cnt(n);
rep(i,n){
cin >> a[i];
ll cnt[a[i]]++;
}
bool a=false;
ll i=n-1;
while(i>=0){
if(i!=0&&cnt[i]!=2){
a=true;
}
if(i==0&&cnt[i]!=1){
a=true;
}
i -=2
}
if(a){
cout << 0 << endl;
}
else{
cout << modpow(2,n/2) << endl;
}
} | a.cc: In function 'll modpow(ll, ll)':
a.cc:24:28: error: 'MDO' was not declared in this scope; did you mean 'MOD'?
24 | return n*modpow(n,a-1)%MDO;
| ^~~
| MOD
a.cc: In function 'int main()':
a.cc:34:17: error: expected initializer before '++' token
34 | ll cnt[a[i]]++;
| ^~
a.cc:36:8: error: conflicting declaration 'bool a'
36 | bool a=false;
| ^
a.cc:30:6: note: previous declaration as 'vl a'
30 | vl a(n);
| ^
a.cc:40:9: error: no match for 'operator=' (operand types are 'vl' {aka 'std::vector<long long int>'} and 'bool')
40 | a=true;
| ^~~~
In file included from /usr/include/c++/14/vector:72,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'bool' to 'const std::vector<long long int>&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'bool' to 'std::vector<long long int>&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'bool' to 'std::initializer_list<long long int>'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:43:9: error: no match for 'operator=' (operand types are 'vl' {aka 'std::vector<long long int>'} and 'bool')
43 | a=true;
| ^~~~
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'bool' to 'const std::vector<long long int>&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'bool' to 'std::vector<long long int>&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'bool' to 'std::initializer_list<long long int>'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:45:10: error: expected ';' before '}' token
45 | i -=2
| ^
| ;
46 | }
| ~
a.cc:47:6: error: could not convert 'a' from 'vl' {aka 'std::vector<long long int>'} to 'bool'
47 | if(a){
| ^
| |
| vl {aka std::vector<long long int>}
|
s968974520 | p03848 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);
//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
// ll a, b;
// cin >> a >> b;
// work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };
//最大公約数
ll gcd(ll x, ll y) {
return y ? gcd(y, x % y) : x;
}
ll lcm(ll x, ll y) {
if (x == 0 || y == 0)return 0;
return (x / gcd(x, y) * y);
}
//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
ll a = 2;
while (n >= a * a) {
if (n % a == 0) {
ins[a]++;
ins[a] = ins[a] % 1000000007;
n /= a;
}
else {
a++;
}
}
ins[n]++;
}
vector<ll>relation[20], money(20, 1);
int main() {
int n;
cin >> n;
vector<int>a(n);
vector<int>b(n);
rep(i, n) {
cin >> a[i];
b[a[i]]++;
}
ll ans = 1;
if (n % 2 != 0) {
rep(i, n) {
if (i == 0 && b[i]!=1) {
cout << 0 << endl;
return 0;
}
if (i % 2 != 0&&b[i]!=0) {
cout << 0 << endl;
return 0;
}
if (i % 2 != 0 && b[i] == 0) {
continue;
}
if (i != 0 && i % 2 == 0 && b[i] != 2) {
cout << 0 << endl;
return 0;
}
ans *= b[i];
ans = ans % (1e9 + 7);
}
}
else {
rep(i, n) {
if (i % 2 != 0 && b[i] != 2) {
cout << 0 << endl;
return 0;
}
if (i % 2 == 0 && b[i] == 0) {
continue;
}
if (i % 2 == 0 && b[i] != 0) {
cout << 0 << endl;
return 0;
}
ans *= b[i];
ans = ans % (1e9 + 7);
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:85:35: error: invalid operands of types 'll' {aka 'long long int'} and 'double' to binary 'operator%'
85 | ans = ans % (1e9 + 7);
| ~~~ ^ ~~~~~~~~~
| | |
| | double
| ll {aka long long int}
a.cc:102:35: error: invalid operands of types 'll' {aka 'long long int'} and 'double' to binary 'operator%'
102 | ans = ans % (1e9 + 7);
| ~~~ ^ ~~~~~~~~~
| | |
| | double
| ll {aka long long int}
|
s633417039 | p03848 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);
//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
// ll a, b;
// cin >> a >> b;
// work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };
//最大公約数
ll gcd(ll x, ll y) {
return y ? gcd(y, x % y) : x;
}
ll lcm(ll x, ll y) {
if (x == 0 || y == 0)return 0;
return (x / gcd(x, y) * y);
}
//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
ll a = 2;
while (n >= a * a) {
if (n % a == 0) {
ins[a]++;
ins[a] = ins[a] % 1000000007;
n /= a;
}
else {
a++;
}
}
ins[n]++;
}
vector<ll>relation[20], money(20, 1);
int main() {
int n;
cin >> n;
vector<int>a(n);
vector<int>b(n);
rep(i, n) {
cin >> a[i];
b[a[i]]++;
}
ll ans = 1;
if (n % 2 != 0) {
rep(i, n) {
if (i == 0 && b[i]!=1) {
cout << 0 << endl;
return 0;
}
if (i % 2 != 0&&b[i]!=0) {
cout << 0 << endl;
retun 0;
}
if (i % 2 != 0 && b[i] == 0) {
continue;
}
if (i != 0 && i % 2 == 0 && b[i] != 2) {
cout << 0 << endl;
return 0;
}
ans *= b[i];
}
}
else {
rep(i, n) {
if (i % 2 != 0 && b[i] != 2) {
cout << 0 << endl;
retun 0;
}
if (i % 2 == 0 && b[i] == 0) {
continue;
}
if (i % 2 == 0 && b[i] != 0) {
cout << 0 << endl;
return 0;
}
ans *= b[i];
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:75:33: error: 'retun' was not declared in this scope
75 | retun 0;
| ^~~~~
a.cc:91:33: error: 'retun' was not declared in this scope
91 | retun 0;
| ^~~~~
|
s186602878 | p03848 | C++ | #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);
//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
// ll a, b;
// cin >> a >> b;
// work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };
//最大公約数
ll gcd(ll x, ll y) {
return y ? gcd(y, x % y) : x;
}
ll lcm(ll x, ll y) {
if (x == 0 || y == 0)return 0;
return (x / gcd(x, y) * y);
}
//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
ll a = 2;
while (n >= a * a) {
if (n % a == 0) {
ins[a]++;
ins[a] = ins[a] % 1000000007;
n /= a;
}
else {
a++;
}
}
ins[n]++;
}
vector<ll>relation[20], money(20, 1);
int main() {
int n;
cin >> n;
vector<int>a(n);
vvector<int>b(n);
rep(i, n) {
cin >> a[i];
b[a[i]]++;
}
ll ans = 1;
if (n % 2 != 0) {
rep(i, n) {
if (i == 0 && b[i]!=1) {
cout << 0 << endl;
return 0;
}
if (i % 2 != 0&&b[i]!=0) {
cout << 0 << endl;
retun 0;
}
if (i % 2 != 0 && b[i] == 0) {
continue;
}
if (i != 0 && i % 2 == 0 && b[i] != 2) {
cout << 0 << endl;
return 0;
}
ans *= b[i];
}
}
else {
rep(i, n) {
if (i % 2 != 0 && b[i] != 2) {
cout << 0 << endl;
retun 0;
}
if (i % 2 == 0 && b[i] == 0) {
continue;
}
if (i % 2 == 0 && b[i] != 0) {
cout << 0 << endl;
return 0;
}
ans *= b[i];
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:61:9: error: 'vvector' was not declared in this scope
61 | vvector<int>b(n);
| ^~~~~~~
a.cc:61:17: error: expected primary-expression before 'int'
61 | vvector<int>b(n);
| ^~~
a.cc:64:17: error: 'b' was not declared in this scope
64 | b[a[i]]++;
| ^
a.cc:69:39: error: 'b' was not declared in this scope
69 | if (i == 0 && b[i]!=1) {
| ^
a.cc:73:41: error: 'b' was not declared in this scope
73 | if (i % 2 != 0&&b[i]!=0) {
| ^
a.cc:75:33: error: 'retun' was not declared in this scope
75 | retun 0;
| ^~~~~
a.cc:77:43: error: 'b' was not declared in this scope
77 | if (i % 2 != 0 && b[i] == 0) {
| ^
a.cc:80:53: error: 'b' was not declared in this scope
80 | if (i != 0 && i % 2 == 0 && b[i] != 2) {
| ^
a.cc:84:32: error: 'b' was not declared in this scope
84 | ans *= b[i];
| ^
a.cc:89:43: error: 'b' was not declared in this scope
89 | if (i % 2 != 0 && b[i] != 2) {
| ^
a.cc:91:33: error: 'retun' was not declared in this scope
91 | retun 0;
| ^~~~~
a.cc:93:43: error: 'b' was not declared in this scope
93 | if (i % 2 == 0 && b[i] == 0) {
| ^
a.cc:96:43: error: 'b' was not declared in this scope
96 | if (i % 2 == 0 && b[i] != 0) {
| ^
a.cc:100:32: error: 'b' was not declared in this scope
100 | ans *= b[i];
| ^
|
s113740946 | p03848 | C++ | #include<bits/stdc++.h>
#include<deque>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
const int maxn = 3e5 + 5;
int n, m;
ll t[maxn], p[maxn], f[maxn], g[maxn], F[maxn], G[maxn], h[maxn];
pair<int, ll> drink[maxn];
struct node
{
ll x, y;
};
long double k(const node &a, const node &b)
{
return long double(a.y - b.y) / long double(a.x - b.x);
}
void rev(ll *a)
{
for (int i = 1; i <= n - i + 1; ++i)swap(a[i], a[n - i + 1]);
}
void cal(ll *dp)
{
p[0] = 0;
for (int i = 1; i <= n; ++i)p[i] = p[i - 1] + t[i];
deque<node> Q;
Q.push_back({ 0, 0 });
dp[0] = 0;
for (int i = 1; i <= n; ++i)
{
dp[i] = dp[i - 1];
while (Q.size() > 1)
{
node temp = Q.front(); Q.pop_front();
node temp2 = Q.front();
ll ans1, ans2;
ans1 = temp.y - i * temp.x - p[i] + (i*i + i) / 2;
ans2 = temp2.y - i * temp2.x - p[i] + (i*i + i) / 2;
if (ans1 > ans2)
{
Q.push_front(temp);
break;
}
}
dp[i] = max(dp[i], Q.front().y - i * Q.front().x - p[i] + (i*i + i) / 2);
//add dp[i]
node temp = { i, dp[i] + p[i] + (i * i - i) / 2 };
while (Q.size() > 1)
{
node back = Q.back(); Q.pop_back();
long double k1 = k(temp, back), k2 = k(back, Q.back());
if (k1 < k2)
{
Q.push_back(back); break;
}
}
Q.push_back(temp);
}
}
void calh(int l, int r)
{
if (l == r)
{
h[l] = max(h[l], f[l - 1] + g[r + 1] + 1 - t[l]);
return;
}
int mid = (l + r >> 1);
for (int i = l; i <= mid; ++i)F[i] = f[i - 1] + p[i - 1] + (i*i - 3 * i) / 2 + 1;
for (int j = mid + 1; j <= r; ++j)G[j] = g[j + 1] - p[j] + (j*j + j * 3) / 2;
deque<node> Q;
for (int i = mid + 1; i <= r; ++i)
{
node now = { i, G[i] };
while (Q.size() > 1)
{
node tmp = Q.back(); Q.pop_back();
long double k1 = k(now, tmp), k2 = k(tmp, Q.back());
if (k1 < k2)
{
Q.push_back(tmp); break;
}
}
Q.push_back(now);
}
ll t = -4e18;
for (int j = l; j <= mid; ++j)
{
while (Q.size() > 1)
{
ll ans1, ans2;
node tmp = Q.back(); Q.pop_back();
ans1 = tmp.y - tmp.x * j, ans2 = Q.back().y - Q.back().x * j;
if (ans1 > ans2)
{
Q.push_back(tmp); break;
}
}
t = max(t, Q.back().y - Q.back().x * j + F[j]);
h[j] = max(t, h[j]);
}
calh(l, mid); calh(mid + 1, r);
}
void solve()
{
cin >> n;
for (int i = 1; i <= n; ++i)cin >> t[i];
cin >> m;
for (int i = 1; i <= m; ++i)cin >> drink[i].first >> drink[i].second;
memset(h, 0xbf, sizeof(h));//初值不能为0,因为要求i必选,值可能为负
cal(f);
rev(t); cal(g);
rev(t); rev(g);
for (int i = 1; i <= n; ++i)p[i] = p[i - 1] + t[i];
calh(1, n);
rev(t);
for (int i = 1; i <= n; ++i)p[i] = p[i - 1] + t[i];
swap(f, g); rev(f); rev(g);
rev(h);
calh(1, n);
rev(t); rev(h); rev(f); rev(g);
swap(f, g);
for (int i = 1; i <= m; ++i)
{
ll p = drink[i].first, v = drink[i].second;
ll ans = max(f[p - 1] + g[p + 1], h[p] + t[p] - v);
cout << ans << "\n";
}
}
signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
// int t; cin >> t;
// for(int i = 1; i <= t; ++i)
solve();
//system("pause");
return 0;
} | a.cc: In function 'long double k(const node&, const node&)':
a.cc:19:16: error: expected primary-expression before 'long'
19 | return long double(a.y - b.y) / long double(a.x - b.x);
| ^~~~
a.cc:19:15: error: expected ';' before 'long'
19 | return long double(a.y - b.y) / long double(a.x - b.x);
| ^~~~~
| ;
a.cc:19:16: error: expected primary-expression before 'long'
19 | return long double(a.y - b.y) / long double(a.x - b.x);
| ^~~~
|
s355972885 | p03848 | C | # include <cstdio>
# include <map>
# include <cmath>
using namespace std;
const int mod = 1e9+7;
int main()
{
int n;
int a[100005];
map<int,int> m;
scanf("%d",&n);
for(int i = 0;i < n;i++)
{
scanf("%d",&a[i]);
m[a[i]]++;
}
int flag = 0;
if(n%2) //奇数
{
if(m[0] != 1)
{
flag = 1;
}
for(int i = 2;i < n;i+=2)
{
if(m[i] != 2)
{
flag = 1;
}
}
}else{
for(int i = 1;i < n;i+=2)
{
if(m[i] != 2)
{
flag = 1;
}
}
}
long long sum = 1;
for(int i =0;i < floor(n/2);i++)
{
sum = ((sum % mod) * 2)% mod;
}
if(n%2)
{
if(flag)
printf("0\n");
else
printf("%lld\n",sum);
}
else
{
if(flag)
printf("0\n");
else
printf("%lld\n",sum);
}
return 0;
} | main.c:1:11: fatal error: cstdio: No such file or directory
1 | # include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s663595798 | p03848 | C++ | from collections import defaultdict
n = int(input())
l = input().split(" ")
l1=defaultdict(int)
for i in range(len(l)):
l[i]=int(l[i])
l1[l[i]]+=1
if l1[0]>=1 and n%2==0:
print(0)
elif l1[0]>1 and n%2==1:
print(0)
else:
prod=1
for key in l1.keys():
prod*=l1[key]
print(prod%(1000000000+7)) | a.cc:1:1: error: 'from' does not name a type
1 | from collections import defaultdict
| ^~~~
|
s140113532 | p03848 | C++ | import math
n=input()
mod = int(1e9) + 7
a=list(map(int,raw_input().split()))
if(len(a)%2==0 and a.count(0)>0):
print(0)
elif(len(a)%2!=0 and a.count(0)>1):
print(0)
else:
res=0
b=set(a)
if(a.count(0)):
print(pow(2,len(b)-1,mod))
else:
print(pow(2,len(b),mod))
| a.cc:1:1: error: 'import' does not name a type
1 | import math
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s848254097 | p03848 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1000000007;
signed main(){
int n;
cin >> n;
map<int,int> a;
for(int i = 0; i < n; i++){
int b;
cin >> b;
a[b]++;
}
if(n % 2 == 1){
for(int i = 0; i < n; i+=2){
bool ans = true;
if(i == 0 && a[i] != 1 || i > 0 && a[i] != 2){
ans = false;
}
if(!ans){
cout << 0 << endl;
return 0;
}
}
}
else
{
for(int i = 1; i < n; i += 2){
if(a[i] != 2)
{
cout << 0 << endl;
return 0;
}
}
}
int ans = 1;
for(int i = 1 < i <(n / 2); i++){
ans *= 2;
ans /= mod;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:43:36: error: expected ';' before ')' token
43 | for(int i = 1 < i <(n / 2); i++){
| ^
| ;
|
s137071637 | p03848 | C++ | #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;
main()
{
int n; cin>>n;
bool isOdd=n%2;
set<int> s;
bool f=true;
int cntz=0;
rep(i,n)
{
int a;
cin>>a;
s.insert(a);
if(isOdd&&a%2==1)f=false;
if(!isOdd&&a%2==0)f=false;
if(a==0)cntz++;
}
if(!f)
{
cout<<0<<endl;
return 0;
}
if(cntz>1)
{
cout<<0<<endl;
return 0;
}
cout<<pow(2,n/2)%mod<<endl;
} | a.cc:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
14 | main()
| ^~~~
a.cc: In function 'int main()':
a.cc:42:21: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%'
42 | cout<<pow(2,n/2)%mod<<endl;
| ~~~~~~~~~~^
| |
| __gnu_cxx::__promote<double>::__type {aka double}
|
s713158374 | p03848 | C++ | N = int(input())
A = list(map(int, input().split()))
data = [0] * N
possible = True
MOD = 10**9+7
for a in A:
data[a] += 1
if N % 2 == 0:
for i in range(1,N,2):
if data[i] != 2:
possible = False
break
else:
if data[0] == 1:
for i in range(2,N,2):
if data[i] != 2:
possible = False
break
else:
possible = False
if possible:
if N % 2 == 0:
num = N // 2
else:
num = (N-1)//2
ans = 1
for i in range(num):
ans = ans * 2 % MOD
ans %= MOD
print(ans)
else:
print(0)
| a.cc:1:1: error: 'N' does not name a type
1 | N = int(input())
| ^
|
s207787446 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
const ll mm=1e9+7;
int sp[maxn],vis[maxn];
int main()
{
int n;
cin>>n;
int flag=0;
memset(vis,0,sizeof(vis));
for(int i=1;i<=n;++i){
cin>>sp[i];
vis[sp[i]]++;
}
if(n%2==1)
{
for(int i=0;i<n;i+=2)
{
if(i==0)
{
if(vis[i]!=1)
{
flag=1;
break;
}
}
else
{
if(vis[i]!=2)
{
flag=1;
break;
}
}
}
if(flag==1)
cout<<0<<endl;
else
{
cout<<pow(2,(n-1)/2)%mm<<endl;
}
}
else if(n%2==0)
{
int flag=0;
for(int i=1;i<n;i+=2)
{
if(vis[i]!=2)
{
flag=1;
break;
}
}
if(flag==0)
{
cout<<pow(2,n/2)%mm<<endl;
}
else cout<<0<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:42:33: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'const ll' {aka 'const long long int'} to binary 'operator%'
42 | cout<<pow(2,(n-1)/2)%mm<<endl;
| ~~~~~~~~~~~~~~^~~
| | |
| | const ll {aka const long long int}
| __gnu_cxx::__promote<double>::__type {aka double}
a.cc:58:29: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'const ll' {aka 'const long long int'} to binary 'operator%'
58 | cout<<pow(2,n/2)%mm<<endl;
| ~~~~~~~~~~^~~
| | |
| | const ll {aka const long long int}
| __gnu_cxx::__promote<double>::__type {aka double}
|
s920435960 | p03848 | C++ | #include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
const int mod = 10e9 + 7;
const int maxn = 10e5 + 5;
int a[maxn];
ll fast_mod(ll base, ll n) {
ll res = 1;
while (n > 0) {
if (n & 1) res = res * base % mod;
base = base * base % mod;
n >>= 1;
}
return res % mod;
}
int main() {
int n, num;
cin >> n;
memset(a, 0, sizeof(a));
for (int i = 1; i <= n; i++) {
cin >> num;
a[num]++;
if (num > n || a[num] > 2 || (n % 2 == 1 && a[0] > 1)) {
printf("0\n"); return 0;
}
}
cout << fast_mod(2, n / 2) << endl;
} | a.cc:7:22: warning: overflow in conversion from 'double' to 'int' changes value from '1.0000000007e+10' to '2147483647' [-Woverflow]
7 | const int mod = 10e9 + 7;
| ~~~~~^~~
a.cc: In function 'int main()':
a.cc:25:9: error: 'memset' was not declared in this scope
25 | memset(a, 0, sizeof(a));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<iostream>
+++ |+#include <cstring>
3 | using namespace std;
|
s765190717 | p03848 | C++ | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
const int Max=100005;
int n,m,s;
int sum[Max];
inline int ksm(int a,int b)
{
int ans=1;
while(b)
{
if(b&1) ans=(ans*a)%mod;
b>>=1;
a=(a*a)%mod;
}
return ans;
}
signed main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&m),sum[m]++;
for(int i=0;i<n;i++) if(sum[i]>=3) {cout<<"0";return 0;}
if((n&1&&sum[0]!=1)||(!(n%2)&&sum[0])) {cout<<"0";return 0;}
cout<<ksm(2,n/2);
return 0;
} | a.cc: In function 'int main()':
a.cc:30:1: error: '\U0000ff5d' was not declared in this scope
30 | }
| ^~
a.cc:30:3: error: expected '}' at end of input
30 | }
| ^
a.cc:23:1: note: to match this '{'
23 | {
| ^
|
s155856433 | p03848 | C++ |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 100005;
const int mod = 1e9+7;
int a[N];
int num[N];
ll qpow(ll a,ll b,ll p)
{
ll ans=1%p;
while(b)
{
if(b&1) ans=(ans*a)%p;
b>>=1;
a=(a*a)%p;
}
return ans;
}
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
num[a[i]]++;
}
if(n%2==1)
{
int flag=1;
for(int i=n-1;i>=0;i-=2)
{
if(i==0)
{
if(num[i]!=1)
{
flag=0;
break;
}
}
else
{
if(num[i]!=2)
{
flag=0;
break;
}
}
}
if(flag==0) printf("0\n");
else
{
ll ans=qpow(2,n/2,mod)%mod;
printf("%lld\n",ans);
}
}
else
{
int flag=1;
for(int i=n-1;i>=1;i-=2)
{
if(num[i]!=2)
{
flag=0;
break;
}
}
if(flag==0) printf("0\n");
else
{
ll ans=qpow(2,n/2,mod)%mod;
printf("%lld\n",ans);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:79:1: error: '\U0000ff5d' was not declared in this scope
79 | }
| ^~
a.cc:79:3: error: expected '}' at end of input
79 | }
| ^
a.cc:21:1: note: to match this '{'
21 | {
| ^
|
s256996326 | p03848 | C++ |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 100005;
const int mod = 1e9+7;
int a[N];
int num[N];
ll qpow(ll a,ll b,ll p)
{
ll ans=1%p;
while(b)
{
if(b&1) ans=(ans*a)%p;
b>>=1;
a=(a*a)%p;
}
return ans;
}
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
num[a[i]]++;
}
if(n%2==1)
{
int flag=1;
for(int i=n-1;i>=0;i-=2)
{
if(i==0)
{
if(num[i]!=1)
{
flag=0;
break;
}
}
else
{
if(num[i]!=2)
{
flag=0;
break;
}
}
}
if(flag==0) printf("0\n");
else
{
ll ans=qpow(2,n/2,mod)%mod;
printf("%lld\n",ans);
}
}
else
{
int flag=1;
for(int i=n-1;i>=1;i-=2)
{
if(num[i]!=2)
{
flag=0;
break;
}
}
if(flag==0) printf("0\n");
else
{
ll ans=qpow(2,n/2,mod)%mod;
printf("%lld\n",ans);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:79:1: error: '\U0000ff5d' was not declared in this scope
79 | }
| ^~
a.cc:79:3: error: expected '}' at end of input
79 | }
| ^
a.cc:21:1: note: to match this '{'
21 | {
| ^
|
s833785990 | p03848 | C++ |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
const int Max=100005;
int n,m,s;
int sum[Max];
inline int ksm(int a,int b)
{
int ans=1;
while(b)
{
if(b&1) ans=(ans*a)%mod;
b>>=1;
a=(a*a)%mod;
}
return ans;
}
signed main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&m),sum[m]++;
for(int i=0;i<n;i++) if(sum[i]>=3) {cout<<"0";return 0;}
if((n&1&&sum[0]!=1)||(!(n%2)&&sum[0])) {cout<<"0";return 0;}
cout<<ksm(2,n/2);
return 0;
} | a.cc: In function 'int main()':
a.cc:31:1: error: '\U0000ff5d' was not declared in this scope
31 | }
| ^~
a.cc:31:3: error: expected '}' at end of input
31 | }
| ^
a.cc:24:1: note: to match this '{'
24 | {
| ^
|
s938108980 | p03848 | Java | import java.util.*;
class Main{
//
static final int DIV = 100000007L;
static final int MAX = 2000000000;
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] ary = new int[n];
for(int i = 0;i < n;i++)ary[i] = sc.nextInt();
Arrays.sort(ary);
if(n==1&&ary[0]==0){
System.out.println(1);
return;
}
if(n%2==0){
if(ary[0]!=1||ary[1]!=1){
System.out.println(0);
return;
}
for(int i = 0;i < n-1;i++){
if(i%2==0&&ary[i]!=ary[i+1]){
System.out.println(0);
return;
}
if(i%2==1&&ary[i]!=ary[i+1]-2){
System.out.println(0);
return;
}
}
}else{
if(ary[0]!=0||ary[1]==0){
System.out.println(0);
return;
}
for(int i = 1;i < n-1;i++){
if(i%2==1&&ary[i]!=ary[i+1]){
System.out.println(0);
return;
}
if(i%2==0&&ary[i]!=ary[i+1]-2){
System.out.println(0);
return;
}
}
}
long ans = 2;
//ans=modpow(n/2);
for(int i = 0;i < n/2-1;i++){
ans = (2*ans)%DIV;
}
System.out.println(ans);
}
static long modpow(long n){
long ans =1;
long a = 2;
while(n>0){
if((n&1)==1)ans = ans*a % DIV;
a = a * a % DIV;
n >>= 1;
}
return ans;
}
} | Main.java:5: error: incompatible types: possible lossy conversion from long to int
static final int DIV = 100000007L;
^
1 error
|
s501228183 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
int calc(int x){
if(x==1) return 2;
x--;
int a=calc(x)%1000000007;
a*=2;
return a;
}
int main(){
int n;
cin>>n;
vector<int> num(n);
for(int i=0;i<n;i++){
cin>>num[i];
}sort(num.begin(),num.end());
if(n==1&&num[0]==0){
cout<<1<<endl; return 0;
}
if(num[0]==0){
if(n%2==0){
cout<<0<<endl; return 0;
}
for(int i=1;i<n;i++){
if(num[i]%2==0 && num[i+1]==num[i]&&num[i-1]!=num[i]){
i++;
continue;
}
cout<<0<<endl; return 0;
}
}else{
if(n%2==1){
cout<<0<<endl; return 0;
}
for(int i=0;i<n;i++){
if(num[i]%2==1 && num[i+1]==num[i] &&num[i-1]!=num[i]){
i++;
continue;
}
cout<<0<<endl; return 0;
}int ans=calc(n/2);
}cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:44:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
44 | }cout<<ans<<endl;
| ^~~
| abs
|
s862120746 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
sort(A.begin(), A.end());
int i;
bool flg;
if (A[0] == 0) {
i = 2;
flg = true;
} else {
i = 1;
flg = false;
}
ll cnt = 0;
for (; i < N; i += 2) {
int last = A[i - 1];
int cur = A[i];
if (last == cur) {
++cnt;
} else {
cnt = -1;
break;
}
}
if (cnt == -1) {
cout << 0 << endl;
} else {
cout << pow(2, cnt) % (pow(10, 9) + 7) << endl;
}
} | a.cc: In function 'int main()':
a.cc:37:25: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
37 | cout << pow(2, cnt) % (pow(10, 9) + 7) << endl;
| ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
| | |
| | __gnu_cxx::__promote<double>::__type {aka double}
| __gnu_cxx::__promote<double>::__type {aka double}
|
s709002664 | p03848 | C++ | n=int(input())
a=list(map(int,input().split()))
a.sort()
cnt=0
ans=1
if n%2==0:
for i in range(n//2):
if a[2*i]==a[2*i+1]==2*i+1:
cnt+=1
ans=(ans*2)%(10**9+7)
else:
break
if cnt==n//2:
print(ans)
else:
print(0)
else:
if a[0]!=0:
print(0)
exit()
for i in range(n//2):
if a[2*i+1]==a[2*i+2]==2*i+2:
cnt+=1
ans=(ans*2)%(10**9+7)
else:
break
if cnt==n//2:
print(ans)
else:
print(0)
| a.cc:1:1: error: 'n' does not name a type
1 | n=int(input())
| ^
|
s962341131 | p03848 | C++ | #include <bits/stdc++.h>
using namespace std;
#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define REP2(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9 lli 9.2E±18 double 1.7E±380
LLI modpow(int p){
LLI s=1;
REP(i,p){
s=s*2%MOD;
}
return s;
}
int main() {
int N;
cin >> N;
vector<int> v(N);
REP(i, N) { cin >> v[i]; }
SORT(v);
if(N % 2 == 0) {
bool valid = true;
REP(i, N / 2) {
if(v[i * 2] != i * 2 + 1 || v[i * 2 + 1] != i * 2 + 1) {
valid = false;
break;
}
}
if(valid) {
cout << pow(2, N / 2);
} else {
cout << 0;
}
} else {
bool valid = true;
if(v[0] != 0) {
valid = false;
}
REP(i, N / 2) {
if(v[i * 2 + 1] != i * 2 + 2 || v[i * 2 + 2] != i * 2 + 2) {
valid = false;
break;
}
}
if(valid) {
cout << modpow(2, N / 2);
} else {
cout << 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:60:27: error: too many arguments to function 'long long int modpow(int)'
60 | cout << modpow(2, N / 2);
| ~~~~~~^~~~~~~~~~
a.cc:21:5: note: declared here
21 | LLI modpow(int p){
| ^~~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.