submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s912103247 | p03673 | C++ | #include<iostream>
using namespace std;
int main() {
int n,ba=100001,fr=99999;
int a[200000];int b[200001];cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
b[100000] = a[0];
for (int i = 1; i < n; i++) {
if (i % 2 == n % 2) { b[ba] = a[i];ba++;}else {b[fr] = a[i];fr--;}}
for (int i = fr + 1; i < ba - 1; i++) {cout << b[i] << " ";}cout << b[ba - 1] << endl;} | a.cc:9:38: error: extended character is not valid in an identifier
9 | if (i % 2 == n % 2) { b[ba] = a[i];ba++;}else {b[fr] = a[i];fr--;}}
| ^
a.cc: In function 'int main()':
a.cc:9:38: error: '\U000000a0b' was not declared in this scope
9 | if (i % 2 == n % 2) { b[ba] = a[i];ba++;}else {b[fr] = a[i];fr--;}}
| ^~
|
s813962295 | p03673 | C++ | #include<iostream>
using namespace std;
int main() {
int n,ba=100001,fr=99999;
int a[200001];
int b[200001];
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
//
b[100000] = a[0];
for (int i = 1; i < n; i++) {
if (i % 2 == n % 2) {
b[ba] = a[i];
ba++;
}
else {
b[fr] = a[i];
fr--;
}
}
for (int i = fr + 1; i < ba - 1; i++) {
cout << b[i] << " ";
}
cout << b[ba - 1] << endl;
} | a.cc:5:1: error: extended character is not valid in an identifier
5 |
| ^
a.cc:8:1: error: extended character is not valid in an identifier
8 |
| ^
a.cc:12:1: error: extended character is not valid in an identifier
12 |
| ^
a.cc:16:1: error: extended character is not valid in an identifier
16 |
| ^
a.cc:25:1: error: extended character is not valid in an identifier
25 |
| ^
a.cc:28:1: error: extended character is not valid in an identifier
28 |
| ^
a.cc:29:1: error: extended character is not valid in an identifier
29 |
| ^
a.cc:30:1: error: extended character is not valid in an identifier
30 |
| ^
a.cc:31:1: error: extended character is not valid in an identifier
31 |
| ^
a.cc:32:1: error: extended character is not valid in an identifier
32 |
| ^
a.cc:33:1: error: extended character is not valid in an identifier
33 |
| ^
a.cc:34:1: error: extended character is not valid in an identifier
34 |
| ^
a.cc:36:1: error: extended character is not valid in an identifier
36 |
| ^
a.cc:38:1: error: extended character is not valid in an identifier
38 |
| ^
a.cc:40:1: error: extended character is not valid in an identifier
40 |
| ^
a.cc:42:1: error: extended character is not valid in an identifier
42 |
| ^
a.cc: In function 'int main()':
a.cc:5:1: error: '\U000000a0' was not declared in this scope
5 |
| ^
a.cc:8:2: error: expected ';' before 'cin'
8 |
| ^
| ;
9 | cin >> n;
| ~~~
a.cc:10:44: error: 'a' was not declared in this scope
10 | for (int i = 0; i < n; i++) cin >> a[i];
| ^
a.cc:12:2: error: expected ';' before 'b'
12 |
| ^
| ;
13 | b[100000] = a[0];
| ~
a.cc:16:2: error: expected ';' before 'b'
16 |
| ^
| ;
17 | b[ba] = a[i];
| ~
a.cc:21:33: error: 'a' was not declared in this scope
21 | b[fr] = a[i];
| ^
a.cc:25:2: error: expected ';' before '}' token
25 |
| ^
| ;
26 | }
| ~
a.cc:28:2: error: expected ';' before '\U000000a0'
28 |
| ^
| ;
29 |
| ~
a.cc:35:30: error: 'i' was not declared in this scope
35 | for (int i = fr + 1; i < ba - 1; i++) {
| ^
a.cc:40:2: error: expected ';' before 'cout'
40 |
| ^
| ;
41 | cout << b[ba - 1] << endl;
| ~~~~
a.cc:42:2: error: expected ';' before '}' token
42 |
| ^
| ;
43 | }
| ~
|
s820174552 | p03673 | C++ | #include<iostream>
using namespace std;
int main() {
int n,ba=100001,fr=99999;
int a[200001];
int b[200001];
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
//
b[100000] = a[0];
for (int i = 1; i < n; i++) {
if (i % 2 == n % 2) {
b[ba] = a[i];
ba++;
}
else {
b[fr] = a[i];
fr--;
}
}
for (int i = fr + 1; i < ba - 1; i++) {
cout << b[i] << " ";
}
cout << b[ba - 1] << endl;
} | a.cc:5:1: error: extended character is not valid in an identifier
5 |
| ^
a.cc:8:1: error: extended character is not valid in an identifier
8 |
| ^
a.cc:12:1: error: extended character is not valid in an identifier
12 |
| ^
a.cc:16:1: error: extended character is not valid in an identifier
16 |
| ^
a.cc:25:1: error: extended character is not valid in an identifier
25 |
| ^
a.cc:28:1: error: extended character is not valid in an identifier
28 |
| ^
a.cc:29:1: error: extended character is not valid in an identifier
29 |
| ^
a.cc:30:1: error: extended character is not valid in an identifier
30 |
| ^
a.cc:31:1: error: extended character is not valid in an identifier
31 |
| ^
a.cc:32:1: error: extended character is not valid in an identifier
32 |
| ^
a.cc:33:1: error: extended character is not valid in an identifier
33 |
| ^
a.cc:34:1: error: extended character is not valid in an identifier
34 |
| ^
a.cc:36:1: error: extended character is not valid in an identifier
36 |
| ^
a.cc:38:1: error: extended character is not valid in an identifier
38 |
| ^
a.cc:40:1: error: extended character is not valid in an identifier
40 |
| ^
a.cc:42:1: error: extended character is not valid in an identifier
42 |
| ^
a.cc: In function 'int main()':
a.cc:5:1: error: '\U000000a0' was not declared in this scope
5 |
| ^
a.cc:8:2: error: expected ';' before 'cin'
8 |
| ^
| ;
9 | cin >> n;
| ~~~
a.cc:10:44: error: 'a' was not declared in this scope
10 | for (int i = 0; i < n; i++) cin >> a[i];
| ^
a.cc:12:2: error: expected ';' before 'b'
12 |
| ^
| ;
13 | b[100000] = a[0];
| ~
a.cc:16:2: error: expected ';' before 'b'
16 |
| ^
| ;
17 | b[ba] = a[i];
| ~
a.cc:21:33: error: 'a' was not declared in this scope
21 | b[fr] = a[i];
| ^
a.cc:25:2: error: expected ';' before '}' token
25 |
| ^
| ;
26 | }
| ~
a.cc:28:2: error: expected ';' before '\U000000a0'
28 |
| ^
| ;
29 |
| ~
a.cc:35:30: error: 'i' was not declared in this scope
35 | for (int i = fr + 1; i < ba - 1; i++) {
| ^
a.cc:40:2: error: expected ';' before 'cout'
40 |
| ^
| ;
41 | cout << b[ba - 1] << endl;
| ~~~~
a.cc:42:2: error: expected ';' before '}' token
42 |
| ^
| ;
43 | }
| ~
|
s162255549 | p03673 | C++ | #include <iostream>
#include <array>
int main(){
std::array <int,200000> a;
int n;
std::cin>>n;
for (int i;i<n;i++){
std::cin>>a.at(i);
}
bool flag = true;
while(flag){
flag = true;
n -=2;
for(int i,i<n/2;i++){
if(a.at(i)!=a.at(i+n/2)){
flag=false;
}
}
}
std::cout<<n<<std::endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:16: error: expected ';' before '<' token
15 | for(int i,i<n/2;i++){
| ^
| ;
a.cc:15:16: error: expected primary-expression before '<' token
|
s166379316 | p03673 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in) ;
int n=sc.nextInt();
int a[]=new int[n];
int i,j;
for(i=0;i<n;i++){
a[i]=sc.nextInt();
}
int b[],c[];
for(i=1;i<=n;i++){
b=new int[i];
c=new int[i];
for(j=0;j<i;j++){
b[j]=a[j];
}
for(j=0;j<i;j++){
c[i]=b[i-j-1];
}
}
for(i=0;i<n;i++){
System.out.print(c[i]+" ");
}
}
} | Main.java:23: error: variable c might not have been initialized
System.out.print(c[i]+" ");
^
1 error
|
s696427527 | p03673 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in) ;
int n=sc.nextInt();
int a[]=new int[n];
int i,j;
for(i=0;i<n;i++){
a[i]=sc.nextInt();
}
int b[],c[];
for(i=1;i<=n;i++){
b[]=new int[i];
c[]=new int[i];
for(j=0;j<i;j++){
b[j]=a[j];
}
for(j=0;j<i;j++){
c[i]=b[i-j-1];
}
}
for(i=0;i<n;i++){
System.out.print(c[i]+" ");
}
}
} | Main.java:13: error: not a statement
b[]=new int[i];
^
Main.java:13: error: ';' expected
b[]=new int[i];
^
Main.java:13: error: not a statement
b[]=new int[i];
^
Main.java:14: error: not a statement
c[]=new int[i];
^
Main.java:14: error: ';' expected
c[]=new int[i];
^
Main.java:14: error: not a statement
c[]=new int[i];
^
6 errors
|
s311878780 | p03673 | Java | int N=sc.nextInt();
int[]a=new int[N];
for(int i=0;i<N;i++){
a[i]=sc.nextInt();
}
Deque<Integer> ad=new ArrayDeque<Integer>();
for(int i=0;i<N;i++){
if(i%2==N%2){
ad.offerLast(a[i]);
}else{
ad.offerFirst(a[i]);
}
}
for(Integer num : ad){
System.out.print(num+" ");
}
System.out.println(); | Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
int N=sc.nextInt();
^
(use --enable-preview to enable unnamed classes)
Main.java:3: error: class, interface, enum, or record expected
for(int i=0;i<N;i++){
^
Main.java:3: error: class, interface, enum, or record expected
for(int i=0;i<N;i++){
^
Main.java:3: error: class, interface, enum, or record expected
for(int i=0;i<N;i++){
^
Main.java:5: error: class, interface, enum, or record expected
}
^
Main.java:9: error: class, interface, enum, or record expected
for(int i=0;i<N;i++){
^
Main.java:9: error: class, interface, enum, or record expected
for(int i=0;i<N;i++){
^
Main.java:9: error: class, interface, enum, or record expected
for(int i=0;i<N;i++){
^
Main.java:12: error: class, interface, enum, or record expected
}else{
^
Main.java:14: error: class, interface, enum, or record expected
}
^
Main.java:18: error: class, interface, enum, or record expected
}
^
11 errors
|
s965411204 | p03673 | C++ | main(){
int N;
list<int> nums;
scanf("%d",&N);
int reverse = 0;//反転フラグ
for(int i = 0;i < N;i++){
int num;
scanf("%d",&num);
if(reverse){
nums.push_front(num);
}else{
nums.push_back(num);
}
reverse = !reverse;
}
//出力
list<int>::iterator itr;
if(reverse){
itr = nums.end();
}else{
itr = nums.begin();
}
for(int i = 0;i < N;i++){
if(reverse){
itr--;
}else{
itr++;
}
printf("%s%d",i!=0?" ":"",*itr);
}
printf("\n");
} | a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:3:5: error: 'list' was not declared in this scope
3 | list<int> nums;
| ^~~~
a.cc:3:10: error: expected primary-expression before 'int'
3 | list<int> nums;
| ^~~
a.cc:4:5: error: 'scanf' was not declared in this scope
4 | scanf("%d",&N);
| ^~~~~
a.cc:10:13: error: 'nums' was not declared in this scope; did you mean 'num'?
10 | nums.push_front(num);
| ^~~~
| num
a.cc:12:13: error: 'nums' was not declared in this scope; did you mean 'num'?
12 | nums.push_back(num);
| ^~~~
| num
a.cc:17:10: error: expected primary-expression before 'int'
17 | list<int>::iterator itr;
| ^~~
a.cc:19:9: error: 'itr' was not declared in this scope
19 | itr = nums.end();
| ^~~
a.cc:19:15: error: 'nums' was not declared in this scope
19 | itr = nums.end();
| ^~~~
a.cc:21:9: error: 'itr' was not declared in this scope
21 | itr = nums.begin();
| ^~~
a.cc:21:15: error: 'nums' was not declared in this scope
21 | itr = nums.begin();
| ^~~~
a.cc:25:13: error: 'itr' was not declared in this scope
25 | itr--;
| ^~~
a.cc:27:13: error: 'itr' was not declared in this scope
27 | itr++;
| ^~~
a.cc:29:36: error: 'itr' was not declared in this scope
29 | printf("%s%d",i!=0?" ":"",*itr);
| ^~~
a.cc:29:9: error: 'printf' was not declared in this scope
29 | printf("%s%d",i!=0?" ":"",*itr);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | main(){
a.cc:31:5: error: 'printf' was not declared in this scope
31 | printf("\n");
| ^~~~~~
a.cc:31:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
|
s552624169 | p03673 | C++ | #include <cctype>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define 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 LL long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
int main(){
LL n;
cin >> n;
vector<int> b;
REP(i, n){
int x;
cin >> x;
if((i % 2 == 0 && n % 2 == 0) ||
(i % 2 == 1 && n % 2 == 1)){
b.pb(x);
}else{
b.insert(b.begin(), x);
}
}
REP(i, n){
cout << b[i];
if(i != n - 1){
cout << " ";
}
}
cout << endl;
| a.cc: In function 'int main()':
a.cc:59:22: error: expected '}' at end of input
59 | cout << endl;
| ^
a.cc:35:11: note: to match this '{'
35 | int main(){
| ^
|
s853761458 | p03673 | C++ | #include<iostream>
using namespace std;
int main(void){
int n,temp;
int a[200000];
int b[200000];
int c[200000];
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n; i++) {
b[i] = a[i];
for (int d = 0, int e = i; d < e; i++, e--)
{
temp = b[d];
b[d] = b[e];
b[e] = temp;
}
}
for (int i = 0; i < n - 1; i++) {
cout << b[i] << " ";
}
cout << b[n];
cout << endl;
} | a.cc: In function 'int main()':
a.cc:16:33: error: expected unqualified-id before 'int'
16 | for (int d = 0, int e = i; d < e; i++, e--)
| ^~~
a.cc:16:32: error: expected ';' before 'int'
16 | for (int d = 0, int e = i; d < e; i++, e--)
| ^~~~
| ;
a.cc:16:49: error: expected ')' before ';' token
16 | for (int d = 0, int e = i; d < e; i++, e--)
| ~ ^
| )
a.cc:16:56: error: 'e' was not declared in this scope
16 | for (int d = 0, int e = i; d < e; i++, e--)
| ^
|
s019261259 | p03673 | C | #include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
long long n;
cin>>n;
long long flag=n;
long long a[n]={0},b[n]={0};
int t=1,count=0;
while(n--){
cin>>a[t];
b[t]=a[t];
if(t>=2){
int temp1=t;
if(t%2==0){
int i=1;
while(i<t){
int swap=0;
swap=b[i];b[i]=b[t];b[t]=swap;
i++;t--;
}
t=temp1;
}
else if(t%2!=0){
int j=1;
while(j!=t){
int swap=0;
swap=b[j];b[j]=b[t];b[t]=swap;
j++;t--;
}
t=temp1;
}
}
t++;
}
for(int k=1;k<flag;k++){
cout<<b[k]<<" ";
}
cout<<b[flag];
return 0;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s871490749 | p03673 | C++ | #include <cctype>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define 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 LL long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
int main(){
LL n;
cin >> n;
deque b;
REP(i, n){
LL x;
cin >> x;
if(i % 2 == 0) push_back(x);
else push_front(x);
}
if(n % 2 == 1){
reverse(b.begin(), b.end());
}
REP(i, n){
cout << b[i];
if(i != n - 1){
cout << " ";
}
}
cout << endl;
}
| a.cc: In function 'int main()':
a.cc:39:15: error: class template argument deduction failed:
39 | deque b;
| ^
a.cc:39:15: error: no matching function for call to 'deque()'
In file included from /usr/include/c++/14/deque:66,
from a.cc:6:
/usr/include/c++/14/bits/stl_deque.h:1003:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> deque(_InputIterator, _InputIterator, const _Alloc&)-> std::deque<_Tp, _Alloc>'
1003 | deque(_InputIterator __first, _InputIterator __last,
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:1003:9: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:976:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::initializer_list<_Tp>, const _Alloc&)-> std::deque<_Tp, _Alloc>'
976 | deque(initializer_list<value_type> __l,
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:976:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:952:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::deque<_Tp, _Alloc>'
952 | deque(deque&& __x, const allocator_type& __a, false_type)
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:952:7: note: candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:948:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::deque<_Tp, _Alloc>'
948 | deque(deque&& __x, const allocator_type& __a, true_type)
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:948:7: note: candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:943:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::deque<_Tp, _Alloc>'
943 | deque(deque&& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:943:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:936:7: note: candidate: 'template<class _Tp, class _Alloc> deque(const std::deque<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::deque<_Tp, _Alloc>'
936 | deque(const deque& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:936:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:933:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&)-> std::deque<_Tp, _Alloc>'
933 | deque(deque&&) = default;
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:933:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:917:7: note: candidate: 'template<class _Tp, class _Alloc> deque(const std::deque<_Tp, _Alloc>&)-> std::deque<_Tp, _Alloc>'
917 | deque(const deque& __x)
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:917:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:890:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::size_t, const _Tp&, const _Alloc&)-> std::deque<_Tp, _Alloc>'
890 | deque(size_type __n, const value_type& __value,
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:890:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:878:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::size_t, const _Alloc&)-> std::deque<_Tp, _Alloc>'
878 | deque(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:878:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:865:7: note: candidate: 'template<class _Tp, class _Alloc> deque(const _Alloc&)-> std::deque<_Tp, _Alloc>'
865 | deque(const allocator_type& __a)
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:865:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:855:7: note: candidate: 'template<class _Tp, class _Alloc> deque()-> std::deque<_Tp, _Alloc>'
855 | deque() = default;
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:855:7: note: template argument deduction/substitution failed:
a.cc:39:15: note: couldn't deduce template parameter '_Tp'
39 | deque b;
| ^
/usr/include/c++/14/bits/stl_deque.h:788:11: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>)-> std::deque<_Tp, _Alloc>'
788 | class deque : protected _Deque_base<_Tp, _Alloc>
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:788:11: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:2277:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::deque(_InputIterator, _InputIterator, _Allocator)-> deque<_ValT, _Allocator>'
2277 | deque(_InputIterator, _InputIterator, _Allocator = _Allocator())
| ^~~~~
/usr/include/c++/14/bits/stl_deque.h:2277:5: note: candidate expects 2 arguments, 0 provided
a.cc:44:32: error: 'push_back' was not declared in this scope
44 | if(i % 2 == 0) push_back(x);
| ^~~~~~~~~
a.cc:45:22: error: 'push_front' was not declared in this scope
45 | else push_front(x);
| ^~~~~~~~~~
|
s784733574 | p03673 | C++ | #include <iostream>
#include <vector>
#define MAX_NUM 1000000000
using namespace std;
int n;
int a[MAX_NUM];
int b[MAX_NUM];
int main()
{
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
for (int i = 0; i < n; ++i) {
b[i] = a[i];
for (int j = 0; j < n / 2; ++j) {
int tmp = b[i];
b[i] = b[n-i-1];
b[n-i-1] = tmp;
}
}
for (int i = 0; i < n - 1; ++i) {
cout << b[i] << " ";
}
cout << b[n-1] << endl;
return 0;
} | /tmp/ccGRkiuL.o: in function `main':
a.cc:(.text+0x96): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccGRkiuL.o
a.cc:(.text+0xb6): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccGRkiuL.o
a.cc:(.text+0xd9): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccGRkiuL.o
a.cc:(.text+0xf1): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccGRkiuL.o
a.cc:(.text+0x111): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccGRkiuL.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccGRkiuL.o
a.cc:(.text+0x1b8): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccGRkiuL.o
collect2: error: ld returned 1 exit status
|
s930256142 | p03673 | C | #include <stdio.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
long long n=0;
int t=1;
long long flag=n;
long long a[n]={0};
scanf("%d",&n);
while(n--){
scanf("%d",&a[t]);
if(t>=2){
int temp1=t;
if(t%2==0){
int i=1;
while(i<t){
int swap=0;
swap=a[i];a[i]=a[t];a[t]=swap;
i++;t--;
}
t=temp1;
}
else if(t%2!=0){
int j=1;
while(j!=t){
int swap=0;
swap=a[j];a[j]=a[t];a[t]=swap;
j++;t--;
}
t=temp1;
}
}
t++;
}
for(int k=1;k<flag;k++){
printf("%d ",a[k]);
}
printf("%d",a[flag]);
return 0;
} | main.c: In function 'main':
main.c:10:17: error: variable-sized object may not be initialized except with an empty initializer
10 | long long a[n]={0};
| ^
|
s193522694 | p03673 | C | #include <stdio.h>
int main(void)
{
int n, a[100000], b[100000], i, j = 0;
scanf("%d", &n);
for (i = 0;i < n;i++) {
scanf("%d", &a[i]);
}
for (i = n - 1;i >= 1;i -= 2) {
b[j] = a[i];
j++;
}
for (i = 0;i < n - 1;i + = 2) {
b[j] = a[i];
}
for (i = 0; i < n - 1; i++) {
printf("%d ", b[i]);
}
printf("%d\n", b[i]);
return 0;
} | main.c: In function 'main':
main.c:18:34: error: expected expression before '=' token
18 | for (i = 0;i < n - 1;i + = 2) {
| ^
|
s954915219 | p03673 | C++ | #include <iostream>
using namespace std;
int main()
{
int n;
int a[200000];
int b[200000];
int i,k;
cin>>n;
for(i=1;i<=n;i++){
cin>>a[i];
}
for(i=1;i<=n;i++){
b[i]=a[i];
for(k=0;k<(j/2);k++){
b[1+k]=b[i-k];
}
}
for(i=1;i<=n;i++){
cout<<b[i]<<" ";
}
cout<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:19: error: 'j' was not declared in this scope
17 | for(k=0;k<(j/2);k++){
| ^
|
s272998563 | p03673 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n, tmp;
cin >> n;
vector<int> b;
for (int i = 0; i < n; ++i){
cin >> tmp;
b.push_back(tmp);
reverse(b.begin(), *b[i]);
}
cout << b[0];
for (int j = 1; j < n; ++j) cout << ' ' << b[j];
cout << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:28: error: invalid type argument of unary '*' (have '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
17 | reverse(b.begin(), *b[i]);
|
s175515550 | p03673 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n, tmp;
cin >> n;
vector<int> b;
for (int i = 0; i < n; ++i){
cin >> tmp;
b.push_back(tmp);
reverse(b.begin(), b[i]);
}
cout << b[0];
for (int j = 1; j < n; ++j) cout << ' ' << b[j];
cout << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:16: error: no matching function for call to 'reverse(std::vector<int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
17 | reverse(b.begin(), b[i]);
| ~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed:
a.cc:17:16: note: deduced conflicting types for parameter '_BIter' ('__gnu_cxx::__normal_iterator<int*, std::vector<int> >' and 'int')
17 | reverse(b.begin(), b[i]);
| ~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
|
s846449833 | p03673 | C | #include <stdio.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
long n=0;
scanf("%d",&n);
long flag=n;
long a[n]={0};
int t=1;
while(n--){
scanf("%d",&a[t]);
if(t>=2){
int temp1=t;
if(t%2==0){
int i=1;
while(i<t){
int swap=0;
swap=a[i];a[i]=a[t];a[t]=swap;
i++;t--;
}
t=temp1;
}
else if(t%2!=0){
int j=1;
while(j!=t){
int swap=0;
swap=a[j];a[j]=a[t];a[t]=swap;
j++;t--;
}
t=temp1;
}
}
t++;
}
for(int k=1;k<flag;k++){
printf("%d ",a[k]);
}
printf("%d",a[flag]);
return 0;
} | main.c: In function 'main':
main.c:9:13: error: variable-sized object may not be initialized except with an empty initializer
9 | long a[n]={0};
| ^
|
s913472041 | p03673 | C++ | #include <iostream>
#include <vector>
using namespace std;
int n;
vector<int> a;
vector<int> b;
void operation(int i)
{
b.push_back(a[i]);
reverse(b.begin(), b.end());
return;
}
int main()
{
cin >> n;
for (int i = 0; i < n; ++i) {
int tmp;
cin >> tmp;
a.push_back(tmp);
}
for (int i = 0; i < n; ++i) {
operation(i);
}
for (int i = 0; i < n - 1; ++i) {
cout << b[i] << " ";
}
cout << b[n-1] << endl;
return 0;
}
| a.cc: In function 'void operation(int)':
a.cc:12:5: error: 'reverse' was not declared in this scope
12 | reverse(b.begin(), b.end());
| ^~~~~~~
|
s527947841 | p03673 | C++ | #include<iostream>
#include<string>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
int n, c = 1, flag = 1, i;
char e;
string line;
cin >> n;
while (n--)
{
cin >> e;
line += e;
reverse(line.begin(), line.end());
}
for (i = 0; i != line.length(); i++)
{
if (i) cout << ' ';
cout << line[i];
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:8: error: unable to find numeric literal operator 'operator""\U0000ff1b'
23 | return 0;
| ^~~
a.cc:23:11: error: expected ';' before '}' token
23 | return 0;
| ^
| ;
24 | }
| ~
|
s231433521 | p03673 | C++ | #include <algorithm>
#include <iostream>
using namespace std;
long long int n,b,c;
long long int a[200001];
int main(){
b=n/2;
c=(n+1)/2
cin>>n;
for(int z=0;z<n;z++){
cin>>a[z]>>" ";
}
if(n%2=1){
for(int i=0;i<c;i++){
a[i+1]=a[n+2-2*(i+1)];
}
for(int j=n;j>c;j--){
a[j]=a[-n-1+2*j];
}
}
if(n%2=0){
for(int i=0;i<b;i++){
a[i+1]=a[n+2-2*(i+1)];
}
for(int j=n;j>b;j--){
a[j]=a[-n-1+2*j];
}
}
for(int k=0;k<n;k++){
cout<<a[k]<<" "<<;
}
} | a.cc: In function 'int main()':
a.cc:9:10: error: expected ';' before 'cin'
9 | c=(n+1)/2
| ^
| ;
10 | cin>>n;
| ~~~
a.cc:12:10: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'const char [2]')
12 | cin>>a[z]>>" ";
| ~~~~~~~~~^~~~~
| | |
| | const char [2]
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:2:
/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:12:12: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'const char*'
12 | cin>>a[z]>>" ";
| ^~~
/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:12:12: error: invalid conversion from 'const char*' to 'short int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(short int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'short unsigned int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(short unsigned int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'unsigned int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(unsigned int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'long int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(long int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'long unsigned int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(long unsigned int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'long long int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(long long int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'long long unsigned int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(long long unsigned int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const void*
a.cc:12:12: error: cannot bind rvalue '(void*)((const void*)((const char*)" "))' to 'void*&'
/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 'const char [2]' 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 'const char [2]' 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 'const char [2]' 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 'const char [2]' 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/ |
s334324512 | p03673 | C++ | #include <algorithm>
#include <iostream>
using namespace std;
long long int n,b,c;
long long int a[200001];
int main(){
b=n/2;
c=(n+1)/2;
cin>>n;
for(int z=0;z<n;z++){
cin>>a[z];
}
if(n%2=1){
for(int i=1;i<=c;i++){
a[i]=a[n+2-2*i];
}
for(int j=n;j>c;j--){
a[j]=a[-n-1+2*j];
}
}
if(n%2=0){
for(int i=1;i<=b;i++){
a[i]=a[n+2-2*i];
}
for(int j=n;j>b;j--){
a[j]=a[-n-1+2*j];
}
}
for(int k=0;k<n;k++){
cout<<a[k];
}
} | a.cc: In function 'int main()':
a.cc:14:5: error: lvalue required as left operand of assignment
14 | if(n%2=1){
| ~^~
a.cc:22:5: error: lvalue required as left operand of assignment
22 | if(n%2=0){
| ~^~
|
s016844194 | p03673 | C++ | #include <algorithm>
#include <iostream>
using namespace std;
long long int n,b,c;
long long int a[200001];
int main(){
b=n/2;
c=(n+1)/2
cin>>n;
for(int z=0;z<n;z++){
cin>>a[z]>>" ";
}
if(n%2=1){
for(int i=1;i<=c;i++){
a[i]=a[n+2-2*i];
}
for(int j=n;j>c;j--){
a[j]=a[-n-1+2*j];
}
}
if(n%2=0){
for(int i=1;i<=b;i++){
a[i]=a[n+2-2*i];
}
for(int j=n;j>b;j--){
a[j]=a[-n-1+2*j];
}
}
for(int k=0;k<n;k++){
cout<<a[k]<<" "<<;
}
} | a.cc: In function 'int main()':
a.cc:9:10: error: expected ';' before 'cin'
9 | c=(n+1)/2
| ^
| ;
10 | cin>>n;
| ~~~
a.cc:12:10: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'const char [2]')
12 | cin>>a[z]>>" ";
| ~~~~~~~~~^~~~~
| | |
| | const char [2]
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:2:
/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:12:12: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'const char*'
12 | cin>>a[z]>>" ";
| ^~~
/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:12:12: error: invalid conversion from 'const char*' to 'short int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(short int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'short unsigned int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(short unsigned int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'unsigned int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(unsigned int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'long int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(long int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'long unsigned int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(long unsigned int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'long long int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(long long int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const char*' to 'long long unsigned int' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const char*
a.cc:12:12: error: cannot bind rvalue '(long long unsigned int)((const char*)" ")' 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:12:12: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
12 | cin>>a[z]>>" ";
| ^~~
| |
| const void*
a.cc:12:12: error: cannot bind rvalue '(void*)((const void*)((const char*)" "))' to 'void*&'
/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 'const char [2]' 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 'const char [2]' 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 'const char [2]' 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 'const char [2]' 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/ |
s952561833 | p03673 | C++ | #include <iostream>
#include <vector>
#include <cstdio>
#include <stdio.h>
using namespace std;
int main(void){
//input
int n;scanf("%d",&n);
vector<int> v;
for(int i=0; i<n ; i++){
int tmp;scanf("%d",&tmp);
v.push_back(tmp);
reverse(begin(v),end(v));
}
//output
for(int i=0; i<n ; i++){
cout << v[i] << " ";
}
cout << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:5: error: 'reverse' was not declared in this scope
16 | reverse(begin(v),end(v));
| ^~~~~~~
|
s250041929 | p03673 | C++ | #include <iostream>
//#include <string>
#include <vector>
using namespace std;
int main() {
int n;
vector<int> v;
cin >> n;
for(int i=0; i<n; i++) {
int a;
cin >> a;
v.push_back(a);
}
vector<int> v2;
for(int i=0; i<n; i++) {
if(i==0) {
v2.push_back(v[i]);
}else {
v2.push_back(v[i]);
reverse(v2.begin(),v2.end());
//cout << v2[0] << v2[1] << endl;
}
}
for(int i=0; i<n; i++) {
if(i<n-1) cout << v2[i] << " ";
else cout << v2[i] << endl;
}
} | a.cc: In function 'int main()':
a.cc:21:7: error: 'reverse' was not declared in this scope
21 | reverse(v2.begin(),v2.end());
| ^~~~~~~
|
s533974716 | p03673 | C++ | #include <iostream>
#include <vector>
#include <cstdio>
#include <stdio.h>
using namespace std;
int main(void){
//input
int n;scanf("%d",&n);
vector<int> v;
for(int i=0; i<n ; i++){
int tmp;scanf("%d",&tmp);
v.push_back(tmp);
reverse(begin(v),end(v));
}
//output
for(int i=0; i<n ; i++){
cout << v[i] << " ";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:5: error: 'reverse' was not declared in this scope
16 | reverse(begin(v),end(v));
| ^~~~~~~
|
s129243592 | p03673 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
vector<int> b;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
for (int i = 0; i < n; ++i) {
b.push_back(a[i]);
reverse(b.begin(), b.end());
}
for (int i = 0; i < n; ++i) {
cout << b[i];
if (i != n - 1) {
cout << " ";
}
}
} | a.cc: In function 'int main()':
a.cc:15:5: error: 'reverse' was not declared in this scope
15 | reverse(b.begin(), b.end());
| ^~~~~~~
|
s877593182 | p03673 | C++ | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
int n;
vector<long long> odds, evens, out_v;
cin >> n;
for (int i=1;i<=n;i++) {
long a;
cin >> a;
if (i%2==1) {
odds.push_back(a);
} else {
evens.push_back(a);
}
}
if (n % 2==1) {
reverse(odds.begin(), odds.end());
odds.insert(odds.end(), evens.begin(), evens.end());
for (int i=0;i<n-1;i++) {
cout << odds[i] << " ";
}
cout << odds[n-1] << endl;
} else {
reverse(evens.begin(), evens.end());
evens.insert(evens.end(), odds.begin(), odds.end());
for (int i=0;i<n-1;i++) {
cout << evens[i] << " ";
}
cout << evens[n-1] << endl;
}
}
| a.cc: In function 'int main()':
a.cc:21:5: error: 'reverse' was not declared in this scope; did you mean 'evens'?
21 | reverse(odds.begin(), odds.end());
| ^~~~~~~
| evens
a.cc:28:5: error: 'reverse' was not declared in this scope; did you mean 'evens'?
28 | reverse(evens.begin(), evens.end());
| ^~~~~~~
| evens
|
s521768153 | p03673 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
vector<int> b;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
for (int i = 0; i < n; ++i) {
b.push_back(a[i]);
std::reverse(b.begin(), b.end());
}
for (int i = 0; i < n; ++i) {
cout << b[i];
if (i != n - 1) {
cout << " ";
}
}
} | a.cc: In function 'int main()':
a.cc:15:10: error: 'reverse' is not a member of 'std'
15 | std::reverse(b.begin(), b.end());
| ^~~~~~~
|
s114809029 | p03673 | C++ | #include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
int main(void){
//input
int n;scanf("%d",&n);
vector<int> v;
for(int i=0; i<n ; i++){
int tmp;scanf("%d",&tmp);
v.push_back(tmp);
reverse(begin(v),end(v));
}
//output
for(int i=0; i<n ; i++){
cout << v[i] << " ";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:15:5: error: 'reverse' was not declared in this scope
15 | reverse(begin(v),end(v));
| ^~~~~~~
|
s296657665 | p03673 | C++ | #include <bits/stdc++.h>
using namespace std;
#define MAXN 200002
int main()
{
int n;
cin>>n;
int a[MAXN];
int x;
for(int i=1;i<=n;++i) cin>>a[i];
for(int i=n;i>0;i-=2)
{
cout<<a[i]<<' ';
x = i+2;
}
for(x;x<n;x+=2)
{
cout<<a[x]<<' ';
}
return 0;
}#include <bits/stdc++.h>
using namespace std;
#define MAXN 200002
int main()
{
int n;
cin>>n;
int a[MAXN];
int x;
for(int i=1;i<=n;++i) cin>>a[i];
for(int i=n;i>0;i-=2)
{
cout<<a[i]<<' ';
x = i+2;
}
for(x;x<n;x+=2)
{
cout<<a[x]<<' ';
}
return 0;
} | a.cc:25:2: error: stray '#' in program
25 | }#include <bits/stdc++.h>
| ^
a.cc:25:3: error: 'include' does not name a type
25 | }#include <bits/stdc++.h>
| ^~~~~~~
a.cc:30:5: error: redefinition of 'int main()'
30 | int main()
| ^~~~
a.cc:6:5: note: 'int main()' previously defined here
6 | int main()
| ^~~~
|
s512164810 | p03673 | C++ | #include <iostream>
using namespace std;
int main(void){
int n;
int i, j;
cin >> n ;
int *a = new int[n];
int *b = new int[n];
int *bf_b = new int[n]; //操作2前の数列b
for(i=0; i < n; i++){
cin >> a[i];
}
for(i=0; i<n; i++){
bf_b[i] = a[i];
for(j=0; j<i; j++){
b[j] = bf_b[i - j -1];
}
for(j=0; j <i; j++){
bf_b[j] = b[j];
}
}
for(i=0; i<n; i++){
cin >> b[i] >> ' ';
}
cout << '\n';
return 0;
} | a.cc: In function 'int main()':
a.cc:28:29: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'char')
28 | cin >> b[i] >> ' ';
| ~~~~~~~~~~~ ^~ ~~~
| | |
| | char
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:28:32: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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:28:32: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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:28:32: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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:28:32: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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:28:32: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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:28:32: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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:28:32: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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:28:32: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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:28:32: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:28:32: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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>]' (near match)
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed:
a.cc:28:32: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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>]' (near match)
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed:
a.cc:28:32: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'char'
28 | cin >> b[i] >> ' ';
| ^~~
/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:28:32: error: invalid conversion from 'char' to 'void*' [-fpermissive]
28 | cin >> b[i] >> ' ';
| ^~~
| |
| char
a.cc:28:32: error: cannot bind rvalue '(void*)32' to 'void*&'
/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>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:28:32: error: invalid conversion from 'char' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
28 | cin >> b[i] >> ' ';
| ^~~
| |
| char
/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>]' (near match)
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed:
a.cc:28:32: error: invalid conversion from 'char' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&) |
s827387047 | p03673 | C++ | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
#include <_mingw.h>
using namespace std;
#define long long ll
int a[200005],n,b[200005];
int main()
{
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
int eo=(n-1)%2;
int cnt1=0;
int cnt2=1;
for(int i=n-1;i>=0;i--){
if(i%2==eo){
b[cnt1]=a[i];
cnt1++;
}
if(i%2!=eo){
b[n-cnt2]=a[i];
cnt2++;
}
}
for(int i=0;i<n;i++){
cout<<b[i]<<" ";
}
return 0;
} | a.cc:24:10: fatal error: _mingw.h: No such file or directory
24 | #include <_mingw.h>
| ^~~~~~~~~~
compilation terminated.
|
s151284236 | p03673 | C++ | //all possible//
#include<iostream>
using namespace std;
int a,b,c,n,i,j,k,l,m;
int main()
{
deque <int> v;
cin>>n;
for(i=0;i<n;i++)
{
cin>>a;
v.push_front(a);
reverse(v.begin(),v.end());
}
reverse(v.begin(),v.end());
for(i=0;i<v.size();i++)
{
cout<<v[i]<<" ";
}
}
| a.cc: In function 'int main()':
a.cc:7:9: error: 'deque' was not declared in this scope
7 | deque <int> v;
| ^~~~~
a.cc:3:1: note: 'std::deque' is defined in header '<deque>'; this is probably fixable by adding '#include <deque>'
2 | #include<iostream>
+++ |+#include <deque>
3 | using namespace std;
a.cc:7:16: error: expected primary-expression before 'int'
7 | deque <int> v;
| ^~~
a.cc:13:17: error: 'v' was not declared in this scope
13 | v.push_front(a);
| ^
a.cc:14:17: error: 'reverse' was not declared in this scope
14 | reverse(v.begin(),v.end());
| ^~~~~~~
a.cc:17:17: error: 'v' was not declared in this scope
17 | reverse(v.begin(),v.end());
| ^
a.cc:17:9: error: 'reverse' was not declared in this scope
17 | reverse(v.begin(),v.end());
| ^~~~~~~
|
s049817358 | p03673 | C++ | /*
長さ n の数列 a1,…,an が与えられます。 空の数列 b に対して、以下の操作を n 回行うことを考えます。
i 回目には
数列の i 番目の要素 ai を b の末尾に追加する。
b を逆向きに並び替える。
この操作をしてできる数列 b を求めて下さい。
制約
1≤n≤2×10^5
0≤ai≤109
n,ai は整数である。
*/
#include<stdio.h>
int *returning(int input[10000],int n)
{
int ret[10000];
int i;
for ( i = 0; i < n; i++)
{
ret[i] = input[n - i - 1];
}
return ret;
}
int main()
{
int n, input[10000];
scanf("%d", &n);
int i;
for ( i = 0; i < n; i++)
{
scanf("%d", &input[i]);
}
int ret[10000];
for ( i = 0; i < n; i++)
{
ret[i] = input[i];
ret = returning(ret, i);
}
for ( i = 0; i < n; i++)
{
printf("%d ", &ret[i]);
}
return 0;
} | a.cc: In function 'int* returning(int*, int)':
a.cc:23:16: warning: address of local variable 'ret' returned [-Wreturn-local-addr]
23 | return ret;
| ^~~
a.cc:17:13: note: declared here
17 | int ret[10000];
| ^~~
a.cc: In function 'int main()':
a.cc:39:21: error: incompatible types in assignment of 'int*' to 'int [10000]'
39 | ret = returning(ret, i);
| ~~~~^~~~~~~~~~~~~~~~~~~
|
s842866433 | p03673 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
vector<int> nums;
vector<int> b;
cin >> n;
for(int i=0;i<n;i++){
int tmp;
cin >> tmp;
nums.push_back(tmp);
}
for(int i=0;i<n;i++){
b.push_back(nums[i]);
reverse(b.begin(), b.end());
}
for(int i=0;i<n-1;i++)
cout << b[i] << " ";
cout << b[n-1] << endl;
}
| a.cc: In function 'int main()':
a.cc:18:5: error: 'reverse' was not declared in this scope
18 | reverse(b.begin(), b.end());
| ^~~~~~~
|
s719220880 | p03673 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
vector<int> nums;
vector<int> b;
cin >> n;
for(int i=0;i<n;i++){
int tmp;
cin >> tmp;
nums.push_back(tmp);
}
for(int i=0;i<n;i++){
b.push_back(nums[i]);
reverse(b.begin(), b.end());
}
for(int i=0;i<n-1;i++)
cout << b[i] << " ";
cout << b[n-1] << endl;
}
| a.cc: In function 'int main()':
a.cc:18:5: error: 'reverse' was not declared in this scope
18 | reverse(b.begin(), b.end());
| ^~~~~~~
|
s545383952 | p03673 | Java | for(int i=0;i<n;i++){
System.out.print(queue.poll());
System.out.print(" ");
} | Main.java:1: error: class, interface, enum, or record expected
for(int i=0;i<n;i++){
^
Main.java:1: error: class, interface, enum, or record expected
for(int i=0;i<n;i++){
^
Main.java:1: error: class, interface, enum, or record expected
for(int i=0;i<n;i++){
^
Main.java:3: error: class, interface, enum, or record expected
System.out.print(" ");
^
Main.java:4: error: class, interface, enum, or record expected
}
^
5 errors
|
s478935930 | p03673 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int ara[n+10];
for(int i=0;i<n;i++) cin>>ara[i];
bool flag=1;
for(int i=n-1;I>0;i-=2) {
if(flag){
cout<<ara[i];
flag=0;
}
else cout<<' ' <<ara[i];
}
flag=1;
for(int i=0;I<n;i+=2) {
if(flag){
cout<<ara[i];
flag=0;
}
else cout<<' ' <<ara[i];
}
} | a.cc: In function 'int main()':
a.cc:10:15: error: 'I' was not declared in this scope
10 | for(int i=n-1;I>0;i-=2) {
| ^
a.cc:18:13: error: 'I' was not declared in this scope
18 | for(int i=0;I<n;i+=2) {
| ^
|
s240110727 | p03673 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(int argc, const char * argv[]) {
long long n;
long long x;
vector<long long> a, b;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
a.push_back(x);
}
for (int i = 0; i < n; i++) {
b.push_back(a[i]);
reverse(b.begin(), b.end());
}
for (int i = 0; i < n; i++) {
cout << b[i];
if (i < n-1) {
cout << ' ';
}else{
cout << endl;
}
}
return 0;
}
| a.cc: In function 'int main(int, const char**)':
a.cc:19:9: error: 'reverse' was not declared in this scope
19 | reverse(b.begin(), b.end());
| ^~~~~~~
|
s185039735 | p03673 | C++ | /* Rohan Balot
NSIT, New Delhi, India */
#include <algorithm>
#include <bitset>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <utility>
#include <unordered_set>
#include <unordered_map>
#include <valarray>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <climits>
#include <cstring>
#include <ctime>
using namespace std;
#define FIND(c, e) (c).find(e) != (c).end()
#define NFIND(c, e) (c).find(e) == (c).end()
#define ALL(t) (t).begin(), (t).end()
#define ALLR(t) (t).rbegin(), (t).rend()
#define MP make_pair
const int N = int( 1e5 ) + 1;
const int M = int( 1e6 ) + 1;
const int MOD = int( 1e9 ) + 7;
const double PI = acos(-1.0);
const double eps = 1e-6;
template<typename T> T gcd(T a,T b){while (b){ T r=a%b;a=b;b=r;}return a;}
template<typename T> T lcm(T a,T b){return (a*b)/gcd(a,b);}
struct graph {
int vertices;
int edges;
vector< vector<int> > adj;
vector< bool > visited;
vector< int > level;
graph() { }
graph(int vertices) {
this->adj.resize(vertices + 1);
this->level.resize(vertices + 1, -1);
this->visited.resize(vertices + 1, false);
this->vertices = vertices;
edges = 0;
}
void add_directed_edge(int from, int to) {
this->adj[from].emplace_back(to);
this->edges++;
}
void add_undirected_edge(int from, int to) {
this->adj[from].emplace_back(to);
this->adj[to].emplace_back(from);
this->edges += 2;
}
void read_undirected_edges(int edge_count) {
this->edges += edge_count << 1;
for (int i = 0; i < edge_count; i++) {
int from, to;
cin >> from >> to;
this->adj[from].emplace_back(to);
this->adj[to].emplace_back(from);
}
}
void read_directed_edges(int edge_count) {
this->edges += edge_count;
for (int i = 0; i < edge_count; i++) {
int from, to;
cin >> from >> to;
this->adj[from].emplace_back(to);
}
}
void dfs(int src) {
this->visited[src] = true;
for(int i : this->adj[src]) {
if(this->visited[i] == false) {
this->dfs(i);
}
}
}
void bfs(int src) {
this->level[src] = 0;
queue<int> q;
q.push(src);
while (!q.empty()) {
int cur = q.front();
q.pop();
for(int i : this->adj[cur]) {
if(this->level[i] == -1) {
this->level[i] = this->level[cur] + 1;
q.push(i);
}
}
}
}
};
void __answer()
{
int n;
cin >> n;
list<int> l;
if(n % 2 == 1) {
for (int i = 1; i <= n; i++) {
int e;
cin >> e;
if(i % 2 == 0)
l.push_back(e);
else l.push_front(e);
}
} else {
for (int i = 1; i <= n; i++) {
int e;
cin >> e;
if(i % 2 == 1)
l.push_back(e);
else l.push_front(e);
}
}
for (auto i : l) {
cout << i << " ";
}
}
int main()
{
ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifdef LOCAL
freopen("sample_input.txt", "r", stdin);
#endif
__answer();
return 0;
} | a.cc: In function 'void __answer()':
a.cc:113:9: error: 'list' was not declared in this scope
113 | list<int> l;
| ^~~~
a.cc:28:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
27 | #include <ctime>
+++ |+#include <list>
28 | using namespace std;
a.cc:113:14: error: expected primary-expression before 'int'
113 | list<int> l;
| ^~~
a.cc:119:33: error: 'l' was not declared in this scope
119 | l.push_back(e);
| ^
a.cc:120:30: error: 'l' was not declared in this scope
120 | else l.push_front(e);
| ^
a.cc:127:33: error: 'l' was not declared in this scope
127 | l.push_back(e);
| ^
a.cc:128:30: error: 'l' was not declared in this scope
128 | else l.push_front(e);
| ^
a.cc:131:23: error: 'l' was not declared in this scope
131 | for (auto i : l) {
| ^
|
s601394021 | p03674 | C++ | #include<bits/stdc++.h>
using namespace std;
#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 ll=long long;
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>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
ll V;
vector<vector<edge> > G;
vector<ll> d;
graph(ll n){
init(n);
}
void init(ll n){
V = n;
G.resize(V);
d.resize(V);
rep(i,V){
d[i] = INF;
}
}
void add_edge(ll s, ll t, ll cost){
edge e;
e.to = t, e.cost = cost;
G[s].push_back(e);
}
void dijkstra(ll s){
rep(i,V){
d[i] = INF;
}
d[s] = 0;
priority_queue<P,vector<P>, greater<P> > que;
que.push(P(0,s));
while(!que.empty()){
P p = que.top(); que.pop();
ll v = p.second;
if(d[v]<p.first) continue;
for(auto e : G[v]){
if(d[e.to]>d[v]+e.cost){
d[e.to] = d[v]+e.cost;
que.push(P(d[e.to],e.to));
}
}
}
}
};
class UnionFind
{
public:
int par[100005];
int depth[100005];
int nGroup[100005];
UnionFind(int n) {
init(n);
}
void init(int n) {
for(int i=0; i<n; i++) {
par[i] = i;
depth[i] = 0;
nGroup[i] = 1;
}
}
int root(int x) {
if(par[x] == x) {
return x;
} else {
return par[x] = root(par[x]);
}
}
bool same(int x, int y) {
return root(x) == root(y);
}
void unite(int x, int y) {
x = root(x);
y = root(y);
if(x == y) return;
if(depth[x] < depth[y]) {
par[x] = y;
nGroup[y] += nGroup[x];
nGroup[x] = 0;
} else {
par[y] = x;
nGroup[x] += nGroup[y];
nGroup[y] = 0;
if(depth[x] == depth[y])
depth[x]++;
}
}
};
const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
ll COM(ll n, ll k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
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(){
ll n; cin>>n;
ll a[n+1]={},b[n+1]={};
ll ca = 0,r = 0,l = 1000000;
rep(i,n+1){
cin>>a[i];
b[a[i]]++;
if(b[a[i]]==2)ca = a[i];}
rep(i,n+1){
if(a[i]==ca){
if(l==1000000) l = i;
else r = i;}
}
//cout << l <<" "<< r;
COMinit();
mint cb = 0;
mint com = 0, co = 0;
repl(i,1,n+2){
cb = 0;
com = COM(n+1,i);
co = COM(n+l-r,i-1);
//cout << com << " " << co << endl;
cb+=com-co;
cb%=MOD;
cout << cb << endl;
}}
| a.cc: In function 'int main()':
a.cc:235:3: error: no match for 'operator%=' (operand types are 'mint' {aka 'Fp<1000000007>'} and 'const ll' {aka 'const long long int'})
235 | cb%=MOD;
| ~~^~~~~
|
s369652806 | p03674 | C++ | #include<bits/stdc++.h>
using namespace std;
#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 ll=long long;
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>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
ll V;
vector<vector<edge> > G;
vector<ll> d;
graph(ll n){
init(n);
}
void init(ll n){
V = n;
G.resize(V);
d.resize(V);
rep(i,V){
d[i] = INF;
}
}
void add_edge(ll s, ll t, ll cost){
edge e;
e.to = t, e.cost = cost;
G[s].push_back(e);
}
void dijkstra(ll s){
rep(i,V){
d[i] = INF;
}
d[s] = 0;
priority_queue<P,vector<P>, greater<P> > que;
que.push(P(0,s));
while(!que.empty()){
P p = que.top(); que.pop();
ll v = p.second;
if(d[v]<p.first) continue;
for(auto e : G[v]){
if(d[e.to]>d[v]+e.cost){
d[e.to] = d[v]+e.cost;
que.push(P(d[e.to],e.to));
}
}
}
}
};
class UnionFind
{
public:
int par[100005];
int depth[100005];
int nGroup[100005];
UnionFind(int n) {
init(n);
}
void init(int n) {
for(int i=0; i<n; i++) {
par[i] = i;
depth[i] = 0;
nGroup[i] = 1;
}
}
int root(int x) {
if(par[x] == x) {
return x;
} else {
return par[x] = root(par[x]);
}
}
bool same(int x, int y) {
return root(x) == root(y);
}
void unite(int x, int y) {
x = root(x);
y = root(y);
if(x == y) return;
if(depth[x] < depth[y]) {
par[x] = y;
nGroup[y] += nGroup[x];
nGroup[x] = 0;
} else {
par[y] = x;
nGroup[x] += nGroup[y];
nGroup[y] = 0;
if(depth[x] == depth[y])
depth[x]++;
}
}
};
const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
ll COM(ll n, ll k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
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(){
ll n; cin>>n;
ll a[n+1]={},b[n+1]={};
mint ca = 0,r = 0,l = 1000000;
rep(i,n+1){
cin>>a[i];
b[a[i]]++;
if(b[a[i]]==2)ca = a[i];}
rep(i,n+1){
if(a[i]==ca){
if(l==1000000) l = i;
else r = i;}
}
//cout << l <<" "<< r;
COMinit();
ca = 0;
mint com = 0, co = 0;
repl(i,1,n+2){
ca = 0;
com = COM(n+1,i);
co = COM(n+l-r,i-1);
//cout << com << " " << co << endl;
ca+=com-co;
ca%=MOD;
cout << ca << endl;
}}
| a.cc: In function 'int main()':
a.cc:221:8: error: no match for 'operator==' (operand types are 'll' {aka 'long long int'} and 'mint' {aka 'Fp<1000000007>'})
221 | if(a[i]==ca){
| ~~~~^~~~
| | |
| | mint {aka Fp<1000000007>}
| ll {aka long long int}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: 'mint' {aka 'Fp<1000000007>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: 'mint' {aka 'Fp<1000000007>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::pair<_T1, _T2>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::fpos<_StateT>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'const std::allocator<_CharT>' and 'll' {aka 'long long int'}
221 | if(a[i]==ca){
| ^~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int'
221 | if(a[i]==ca){
| ^~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:221:10: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'l |
s621984759 | p03674 | C++ | #include<bits/stdc++.h>
using namespace std;
#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 ll=long long;
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>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
ll V;
vector<vector<edge> > G;
vector<ll> d;
graph(ll n){
init(n);
}
void init(ll n){
V = n;
G.resize(V);
d.resize(V);
rep(i,V){
d[i] = INF;
}
}
void add_edge(ll s, ll t, ll cost){
edge e;
e.to = t, e.cost = cost;
G[s].push_back(e);
}
void dijkstra(ll s){
rep(i,V){
d[i] = INF;
}
d[s] = 0;
priority_queue<P,vector<P>, greater<P> > que;
que.push(P(0,s));
while(!que.empty()){
P p = que.top(); que.pop();
ll v = p.second;
if(d[v]<p.first) continue;
for(auto e : G[v]){
if(d[e.to]>d[v]+e.cost){
d[e.to] = d[v]+e.cost;
que.push(P(d[e.to],e.to));
}
}
}
}
};
class UnionFind
{
public:
int par[100005];
int depth[100005];
int nGroup[100005];
UnionFind(int n) {
init(n);
}
void init(int n) {
for(int i=0; i<n; i++) {
par[i] = i;
depth[i] = 0;
nGroup[i] = 1;
}
}
int root(int x) {
if(par[x] == x) {
return x;
} else {
return par[x] = root(par[x]);
}
}
bool same(int x, int y) {
return root(x) == root(y);
}
void unite(int x, int y) {
x = root(x);
y = root(y);
if(x == y) return;
if(depth[x] < depth[y]) {
par[x] = y;
nGroup[y] += nGroup[x];
nGroup[x] = 0;
} else {
par[y] = x;
nGroup[x] += nGroup[y];
nGroup[y] = 0;
if(depth[x] == depth[y])
depth[x]++;
}
}
};
const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
ll COM(ll n, ll k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
ll n; cin>>n;
ll a[n+1]={},b[n+1]={};
mint ca = 0,r = 0,l = 1000000;
rep(i,n+1){
cin>>a[i];
b[a[i]]++;
if(b[a[i]]==2)ca = a[i];}
rep(i,n+1){
if(a[i]==ca){
if(l==1000000) l = i;
else r = i;}
}
//cout << l <<" "<< r;
COMinit();
ca = 0;
mint com = 0, co = 0;
repl(i,1,n+2){
ca = 0;
com = COM(n+1,i);
co = COM(n+l-r,i-1);
//cout << com << " " << co << endl;
ca+=com-co;
ca%=MOD;
cout << ca << endl;
}}
| a.cc: In function 'int main()':
a.cc:151:1: error: 'mint' was not declared in this scope; did you mean 'uint'?
151 | mint ca = 0,r = 0,l = 1000000;
| ^~~~
| uint
a.cc:155:15: error: 'ca' was not declared in this scope; did you mean 'a'?
155 | if(b[a[i]]==2)ca = a[i];}
| ^~
| a
a.cc:157:10: error: 'ca' was not declared in this scope; did you mean 'a'?
157 | if(a[i]==ca){
| ^~
| a
a.cc:158:4: error: 'l' was not declared in this scope
158 | if(l==1000000) l = i;
| ^
a.cc:159:6: error: 'r' was not declared in this scope
159 | else r = i;}
| ^
a.cc:163:1: error: 'ca' was not declared in this scope; did you mean 'a'?
163 | ca = 0;
| ^~
| a
a.cc:164:5: error: expected ';' before 'com'
164 | mint com = 0, co = 0;
| ^~~~
| ;
a.cc:167:1: error: 'com' was not declared in this scope; did you mean 'cos'?
167 | com = COM(n+1,i);
| ^~~
| cos
a.cc:168:1: error: 'co' was not declared in this scope; did you mean 'cos'?
168 | co = COM(n+l-r,i-1);
| ^~
| cos
a.cc:168:12: error: 'l' was not declared in this scope
168 | co = COM(n+l-r,i-1);
| ^
a.cc:168:14: error: 'r' was not declared in this scope
168 | co = COM(n+l-r,i-1);
| ^
|
s288173174 | p03674 | C++ | #include<bits/stdc++.h>
using namespace std;
#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 ll=long long;
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>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
ll V;
vector<vector<edge> > G;
vector<ll> d;
graph(ll n){
init(n);
}
void init(ll n){
V = n;
G.resize(V);
d.resize(V);
rep(i,V){
d[i] = INF;
}
}
void add_edge(ll s, ll t, ll cost){
edge e;
e.to = t, e.cost = cost;
G[s].push_back(e);
}
void dijkstra(ll s){
rep(i,V){
d[i] = INF;
}
d[s] = 0;
priority_queue<P,vector<P>, greater<P> > que;
que.push(P(0,s));
while(!que.empty()){
P p = que.top(); que.pop();
ll v = p.second;
if(d[v]<p.first) continue;
for(auto e : G[v]){
if(d[e.to]>d[v]+e.cost){
d[e.to] = d[v]+e.cost;
que.push(P(d[e.to],e.to));
}
}
}
}
};
class UnionFind
{
public:
int par[100005];
int depth[100005];
int nGroup[100005];
UnionFind(int n) {
init(n);
}
void init(int n) {
for(int i=0; i<n; i++) {
par[i] = i;
depth[i] = 0;
nGroup[i] = 1;
}
}
int root(int x) {
if(par[x] == x) {
return x;
} else {
return par[x] = root(par[x]);
}
}
bool same(int x, int y) {
return root(x) == root(y);
}
void unite(int x, int y) {
x = root(x);
y = root(y);
if(x == y) return;
if(depth[x] < depth[y]) {
par[x] = y;
nGroup[y] += nGroup[x];
nGroup[x] = 0;
} else {
par[y] = x;
nGroup[x] += nGroup[y];
nGroup[y] = 0;
if(depth[x] == depth[y])
depth[x]++;
}
}
};
const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
ll COM(ll n, ll k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
ll n; cin>>n;
ll a[n+1]={},b[n+1]={};
ll ca = 0,r = 0,l = 0;
rep(i,n+1){
cin>>a[i];
b[a[i]]++;
if(b[a[i]]==2)ca = i;}
rep(i,n+1){
if(a[i]==ca){
if(l==0) l = i;
else r = i;}
}
COMinit();
ca = 0;
ll com = 0, co = 0;
repl(i,1,n+2){
com = COM(n+1,i);
co = COM(n+1+l-r,i-1);
ca+=com-co;
ca%=MOD;
}
cout << ca << endl;}} | a.cc:170:21: error: expected declaration before '}' token
170 | cout << ca << endl;}}
| ^
|
s443530382 | p03674 | C++ | // {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f\n",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }
template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
sort(begin(v),end(v),f);
v.resize(unique(begin(v),end(v))-begin(v));
}
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
#ifdef UNO
template<class T> void _dump(const char *s, T &&head) { cerr << s << "=" << head << endl; }
template<class T, class... Args> void _dump(const char *s, T &&head, Args &&... tail) {
for (int c = 0; *s != ',' || c != 0; cerr << *s++) {
if (*s == '(' || *s == '[' || *s == '{') c++;
if (*s == ')' || *s == ']' || *s == '}') c--;
}
cerr << "=" << head << ", ";
_dump(s + 1, tail...);
}
#define dump(...) do { fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); _dump(#__VA_ARGS__, __VA_ARGS__); } while (0)
template<class Iter> ostream &_out(ostream &s, Iter b, Iter e) {
s << "[";
for (auto it = b; it != e; it++) s << (it == b ? "" : " ") << *it;
return s << "]";
}
template<class A, class B> ostream &operator<<(ostream &s, const pair<A, B> &p) { return s << "(" << p.first << "," << p.second << ")"; }
template<class T> ostream &operator<<(ostream &s, const vector<T> &c) { return _out(s, ALL(c)); }
template<class T, size_t N> ostream &operator<<(ostream &s, const array<T, N> &c) { return _out(s, ALL(c)); }
template<class T> ostream &operator<<(ostream &s, const set<T> &c) { return _out(s, ALL(c)); }
template<class A, class B> ostream &operator<<(ostream &s, const map<A, B> &c) { return _out(s, ALL(c)); }
#else
#define dump(...)
#endif
// }}}
// {{{ ModInt
template<int _MOD>
struct ModInt {
static const auto MOD = _MOD;
template<class T> using integral_only = typename enable_if<is_integral<T>::value>::type;
int x;
constexpr ModInt() : x() {}
template<class T, integral_only<T>* = nullptr>
ModInt(T _x=0) {
x = _x % MOD;
if(x<0) x+=MOD;
}
ModInt operator-() const { return {x == 0? 0 : MOD-x}; }
ModInt& operator+=(const ModInt a) {
if ((x += a.x) >= MOD) x -= MOD;
return *this;
}
ModInt& operator-=(const ModInt a) {
if ((x += MOD-a.x) >= MOD) x -= MOD;
return *this;
}
ModInt& operator*=(const ModInt a) {
x = (long long)x * a.x % MOD;
return *this;
}
ModInt& operator/=(const ModInt a) {
return (*this) *= a.inv();
}
ModInt operator+(const ModInt a) const { return ModInt(*this) += a; }
ModInt operator-(const ModInt a) const { return ModInt(*this) -= a; }
ModInt operator*(const ModInt a) const { return ModInt(*this) *= a; }
ModInt operator/(const ModInt a) const { return ModInt(*this) /= a; }
ModInt inv() const {
// for prime MOD
return pow(MOD-2);
}
ModInt inv2() const {
// work for non-prime MOD if gcd(x,MOD) = 1
int a = x, b = MOD, u = 1, v = 0;
while(b != 0) {
int t = a / b;
a -= t * b;
u -= t * v;
swap(a, b);
swap(u, v);
}
return u;
}
template<class T, integral_only<T>* = nullptr>
ModInt pow(T t) const {
ModInt r = 1, p = *this;
while(t) {
if(t & 1) r *= p;
p *= p;
t >>= 1;
}
return r;
}
bool operator==(ModInt rhs) const { return x == rhs.x; }
bool operator!=(ModInt rhs) const { return x != rhs.x; }
bool operator<(ModInt rhs) const { return x < rhs.x; }
bool operator<=(ModInt rhs) const { return x <= rhs.x; }
bool operator>(ModInt rhs) const { return x > rhs.x; }
bool operator>=(ModInt rhs) const { return x >= rhs.x; }
friend string to_string(ModInt i) { return to_string(i.x); }
friend istream& operator>>(istream&i,ModInt&a) { return i>>a.x; }
friend ostream& operator<<(ostream&o,const ModInt&a) { return o<<a.x; }
};
const int MOD=1000000007;
using mint=ModInt<MOD>;
// }}}
const int N=1e5+5;
mint fact[N],ifact[N];
int used[N];
void init( int n ) {
fact[0]=1;
REP(i,n) fact[i+1]=fact[i]*(i+1);
ifact[n]=fact[n].inv();
for ( int i=n; i>0; i-- ) ifact[i-1]=ifact[i]*i;
}
mint C( int n, int r ) {
if ( n<0||r>n ) return 0;
return fact[n]*ifact[r]*ifact[n-r];
}
int main() {
int n;
cin >> n;
init(n+2);
VI a(n);
REP(i,n) cin >> a[i];
memset(used,-1,sizeof(used));
int r=0;
REP(i,n) { if ( used[a[i]]!=-1 ) {
k=a[i];
l=used[a[i]];
r=i;
} else {
used[a[i]]=i;
} }
cout << n << '\n';
REP1(i,2,n+1) {
mint tot=C(n+1,i);
mint x=C(n+1-r,i);
// cout << tot << ' ' << x << '\n';
cout << tot-x << '\n';
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:162:9: error: 'k' was not declared in this scope
162 | k=a[i];
| ^
a.cc:163:9: error: 'l' was not declared in this scope
163 | l=used[a[i]];
| ^
|
s362035661 | p03674 | C++ | //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
int main() {
int n,dis; cin>>n;
vector<int> me(n+1,-1);
int ad;
rep(i,n+1){
scanf("%d",&d);
if(me[ad]>=0){
dis=i-me[ad]+1; break;
}
else{
me[ad]=i;
}
}
vector<ll> v(n+2,0); v[1]=1;
for(int i=2;i<=n+1;i++){
v[i]=(-v[MOD%i]*(MOD/i))%MOD;
}
ll c=1,d=1;
rep(i,n+1){
c=((c*(n+1-i))%MOD)*v[i+1]%MOD;
c=(c+MOD)%MOD;
printf("%lld\n",(c-d+MOD)%MOD);
d=((d*(n+1-dis-i))%MOD)*v[i+1]%MOD;
d=(d+MOD)%MOD;
}
}
| a.cc: In function 'int main()':
a.cc:22:21: error: 'd' was not declared in this scope
22 | scanf("%d",&d);
| ^
|
s181720039 | p03674 | C++ | //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
int main() {
int n,dis; cin>>n;
vector<int> me(n+1,-1);
int ad;
rep(i,n+1){
scanf("%d",&ad);
if(me[ad]>=0){
dis=i-me[ad]+1; break;
}
else{
me[ad]=i;
}
}
vector<ll> v(n+2,0); v[1]=1;
for(int i=2;i<=n+1;i++){
v[i]=(-v[MOD%i]*(MOD/i))%MOD;
}
ll c=1,d=1;
rep(i,n+1){
c=((c*(n+1-i))%MOD)*v[i+1]%MOD;
c=(c+MOD)%MOD;
print("%d",(c-d+MOD)%MOD);
d=((d*(n+1-dis-i))%MOD)*v[i+1]%MOD;
d=(d+MOD)%MOD;
}
}
| a.cc: In function 'int main()':
a.cc:38:9: error: 'print' was not declared in this scope; did you mean 'rint'?
38 | print("%d",(c-d+MOD)%MOD);
| ^~~~~
| rint
|
s377293683 | p03674 | C++ | //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
int main() {
int n,dis; cin>>n;
vector<int> me(n+1,-1);
int ad;
rep(i,n+1){
scanf("%d",&d);
if(me[ad]>=0){
dis=i-me[ad]+1; break;
}
else{
me[ad]=i;
}
}
vector<ll> v(n+2,0); v[1]=1;
for(int i=2;i<=n+1;i++){
v[i]=(-v[MOD%i]*(MOD/i))%MOD;
}
ll c=1,d=1;
rep(i,n+1){
c=((c*(n+1-i))%MOD)*v[i+1]%MOD;
c=(c+MOD)%MOD;
print("%d",(c-d+MOD)%MOD);
d=((d*(n+1-dis-i))%MOD)*v[i+1]%MOD;
d=(d+MOD)%MOD;
}
} | a.cc: In function 'int main()':
a.cc:22:21: error: 'd' was not declared in this scope
22 | scanf("%d",&d);
| ^
a.cc:38:9: error: 'print' was not declared in this scope; did you mean 'rint'?
38 | print("%d",(c-d+MOD)%MOD);
| ^~~~~
| rint
|
s703561494 | p03674 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// https://freestylewiki.xyz/fswiki/wiki.cgi?page=AtCoder+Beginner+Contest+066
ll mod = 1000000007;
ll factorial[100002];
ll mod_factorial[100002];
ll pow(ll factor, ll q) {
if (q == 1) {
return factor % mod;
}
if (q % 2 == 0) {
ll sub = pow(factor, q / 2);
return ((sub % mod) * (sub % mod)) % mod;
} else {
return ((factor % mod) * (pow(factor, q - 1) % mod)) % mod;
}
}
void init() {
for (ll i = 0; i <= 100001; i++) {
if (i == 0 || i == 1) {
factorial[i] = 1;
} else {
factorial[i] = ((i % mod) * (factorial[i - 1] % mod)) % mod;
}
}
for (ll i = 0; i <= 100001; i++) {
if (i == 0 || i == 1) {
mod_factorial[i] = 1;
} else {
mod_factorial[i] = pow(factorial[i], mod -2 ) % mod;
}
}
}
ll C(ll n, ll k) {
if (n < k) {
return 0;
}
ll sub = ((factorial[n] % mod) * (mod_factorial[k] % mod)) % mod;
return ((sub % mod) * (mod_factorial[n - k] % mod)) % mod;
}
int main() {
ll N;
cin >> N;
vector<ll> list(N);
map<ll, int> m;
ll v;
for (ll i = 0; i < N + 1; i++) {
cin >> list[i];
m[list[i]]++;
if (m[list[i]] == 2) {
v = list[i];
}
}
ll fv = -1, sv = -1;
for (ll i = 0; i < N + 1; i++) {
if (list[i] == v && fv == -1) {
fv = i;
} else if (list[i] == v && sv == -1) {
sv = i;
}
}
init();
for (ll i = 1; i <= N + 1; i++) {
if (1 == 1) {
cout << n << endl;
} else {
if (i == n + 1) {
cout << 1 << endl;
} else {
cout << (C(N + 1, i) % mod + mod - C(fv + N - sv, i - 1) % mod) % mod << endl;
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:74:15: error: 'n' was not declared in this scope
74 | cout << n << endl;
| ^
a.cc:76:16: error: 'n' was not declared in this scope
76 | if (i == n + 1) {
| ^
|
s801016203 | p03674 | C++ | #include<iostream>
#include<vector>
#include<utility>
using namespace std;
const int MAX = 10000000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
// 前処理
COMinit();
int n;cin >> n;
vector<int> a(n+1);for(int i=0;i<n+1;i++){cin >> a[i];a[i]-=1;}
vector<bool> b(n,true);
for(int i=0;i<n+1;i++){b[a[i]]=!b[a[i]];}
pair<int,int> p=make_pair(-1,-1);
for(int i=0;i<n+1;i++){
if(b[a[i]]){
if(p.first==-1){p.first=i;}
else{p.second=i;break;}
}
}
for(int i=1;i<=n+1;i++){
//cout << (COM(n+1,i)-COM(n+1-(p.second-p.first+1),i-1))%MOD << endl;
int c=COM(n+1,i)-COM(p.first+(n-p.second),i-1)
while(c<0){
c+=MOD;
}
cout << c%MOD << endl;
//cout << COM(p.first+(n-1-p.second),i-1)%MOD << endl;
}
}
| a.cc: In function 'int main()':
a.cc:47:5: error: expected ',' or ';' before 'while'
47 | while(c<0){
| ^~~~~
|
s624887007 | p03674 | C++ | #include<iostream>
#include<vector>
#include<utility>
using namespace std;
const int MAX = 10000000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(ll n, ll k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
// 前処理
COMinit();
int n;cin >> n;
vector<int> a(n+1);for(int i=0;i<n+1;i++){cin >> a[i];a[i]-=1;}
vector<bool> b(n,true);
for(int i=0;i<n+1;i++){b[a[i]]=!b[a[i]];}
pair<int,int> p=make_pair(-1,-1);
for(int i=0;i<n+1;i++){
if(b[a[i]]){
if(p.first==-1){p.first=i;}
else{p.second=i;break;}
}
}
for(int i=1;i<=n+1;i++){
//cout << (COM(n+1,i)-COM(n+1-(p.second-p.first+1),i-1))%MOD << endl;
cout << (COM(n+1,i)-COM(p.first+(n-p.second),i-1)) << endl;
//cout << COM(p.first+(n-1-p.second),i-1)%MOD << endl;
}
}
| a.cc:24:15: error: 'll' was not declared in this scope
24 | long long COM(ll n, ll k){
| ^~
a.cc:24:21: error: 'll' was not declared in this scope
24 | long long COM(ll n, ll k){
| ^~
a.cc:24:25: error: expression list treated as compound expression in initializer [-fpermissive]
24 | long long COM(ll n, ll k){
| ^
a.cc: In function 'int main()':
a.cc:46:17: error: 'COM' cannot be used as a function
46 | cout << (COM(n+1,i)-COM(p.first+(n-p.second),i-1)) << endl;
| ~~~^~~~~~~
a.cc:46:28: error: 'COM' cannot be used as a function
46 | cout << (COM(n+1,i)-COM(p.first+(n-p.second),i-1)) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
|
s062324069 | p03674 | C++ | #include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1<<29
#define LLINF 1LL<<60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll N;
ll fact[100010];
ll ifact[100010];
ll modcomb(ll n, ll k){
if(k < 0 || k > n) return 0;
ll ans = fact[n];
ans = ans * ifact[k] % MOD;
ans = ans * ifact[n-k] % MOD;
return ans;
}
int main() {
scanf("%llu", &N);
vector<ll> cnt(N+1, -1);
ll a, d1, d2, diff;
REP(i, N) {
scanf("%llu", &a);
if(cnt[a] != -1) {
d1 = min(cnt[a], ll(i));
d2 = max(cnt[a], ll(i));
diff = d2 - d1;
break;
}
cnt[a] = i;
}
fact[0] = 1;
ifact[0] = 1;
FOR(i, 1, N+2) {
fact[i] = fact[i-1] * i % MOD;
ifact[i] = modpow(fact[i], MOD-2);
}
ll ans;
printf("%lld\n", N);
FOR(k, 2, N) {
ans = modcomb(N+1, k);
ans = (ans - modcomb(N-diff), k-1) + MOD) % MOD;
printf("%llu\n", ans);
}
printf("1\n");
return 0;
}
| a.cc: In function 'int main()':
a.cc:62:29: error: too few arguments to function 'll modcomb(ll, ll)'
62 | ans = (ans - modcomb(N-diff), k-1) + MOD) % MOD;
| ~~~~~~~^~~~~~~~
a.cc:30:4: note: declared here
30 | ll modcomb(ll n, ll k){
| ^~~~~~~
|
s131953656 | p03674 | C++ | #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;
vector<int> fact_inv(100000, -1), fact(10001, -1);
ll pow(int a, int b) {
if (!b) {
return 1;
}
else if (b % 2 == 0) {
ll d = pow(a, b/2);
return (d * d)%MOD;
}
else {
return (a*pow(a, b-1))%MOD;
}
}
ll factional(int a){
if(fact[a] != -1) return ll(fact[a]);
ll ret = 1;
REP(i, a) ret = ret * (i+1) % MOD;
fact[a] = int(ret);
return ret;
}
ll inv(int a){
if(fact_inv[a] != -1) return ll(fact_inv[a]);
fact_inv[a] = int(pow(a, int(MOD-2)));
return ll(fact_inv[a]);
}
ll comb(int a, int b){
if(a < b) return 0;
if(a < 0 || b < 0) reuturn 0;
ll ret = factional(a);
REP(i, b) ret = ret * inv(i+1) % MOD;
REP(i, a-b) ret = ret * inv(i+1) % MOD;
return ret;
}
int main(){
int n; cin >> n;
int dif;
vector<int> idx(n, 0);
REP(i, n+1){
int a; cin >> a;
if(idx[a-1] == 0) idx[a-1] = i+1;
else dif = i+1 - idx[a-1];
}
REP(i, n+1){
cout << (comb(n+1, i+1) - comb(n-dif, i)) % MOD << "\n";
}
return 0;
} | a.cc: In function 'll comb(int, int)':
a.cc:50:24: error: 'reuturn' was not declared in this scope
50 | if(a < 0 || b < 0) reuturn 0;
| ^~~~~~~
|
s699471698 | p03674 | Java | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.*;
public class Main {
static int mod=1_000_000_007;
static long factorial(int n) {
long tmp = 1;
for (int i=n;i>0;i--) {
tmp = (tmp*i) % mod;
}
return tmp;
}
static long pow(long a,int n) {
long res=1;
while (n>0) {
if ((n-n/2*2)==1) {
res=res*a%mod;
}
a=a*a%mod;
n>>=1;
}
return res;
}
static long modinv(long n) {
return pow(n, mod-2);
}
static long nCr(int n, int r) {
if(n<0 || r<0 || n<r)return 0;
return factorial(n) * modinv(factorial(n-r)) % mod * modinv(factorial(r)) % mod;
}
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
int n = in.nextInt();
int[] a = new int[n+1];
int[] cnt = new int[n];
int index=-1;
for (int i=0;i<n+1;i++) {
a[i] = in.nextInt();
cnt[a[i]-1]++;
if (cnt[a[i]-1]==2) {
index=a[i]-1;
}
}
int[] index_array = new int[2];
int l=0;
for (int i=0;i<n+1;i++) {
if (a[i]-1==index) {
index_array[l]=i;
l++;
}
}
long[] n1_C_i = new long[n+2];
n1_C_i[0]=1;
for (int i=0;i<n+1;i++) {
n1_C_i[i+1] = n1_C_i[i] * (long)(n+1-i)%mod*modinv(i+1)%mod;
}
// long[] bunshi_1 = new long[n+2];
// long[] bunbo_1 = new long[n+2];
// bunshi_1[0]=1;
// bunbo_1[0]=1;
// for (int i=0;i<n+1;i++) {
// bunshi_1[i+1] = bunshi_1[i]*(n+1-i)%mod;
// bunbo_1[i+1] = bunbo_1[i]*(i+1)%mod;
// }
// long[] bunshi_2 = new long[index_array[0]+(n-index_array[1])+1];
// long[] bunbo_2 = new long[index_array[0]+(n-index_array[1])+1];
// bunshi_2[0]=1;
// bunbo_2[0]=1;
// for (int i=0;i<index_array[0]+(n-index_array[1]);i++) {
// bunshi_2[i+1] = bunshi_2[i]*(index_array[0]+(n-index_array[1])-i)%mod;
// bunbo_2[i+1] = bunbo_2[i]*(i+1)%mod;
// }
long[] n2_C_i = new long[index_array[0]+(n-index_array[1])+1];
n2_C_i[0]=1;
for (int i=0;i<index_array[0]+(n-index_array[1]);i++) {
n2_C_i[i+1] = n2_C_i[i] * (long)(index_array[0]+(n-index_array[1])-i)%mod*modinv(i+1)%mod;
}
// System.out.println(Arrays.toString(n2_C_i));
// System.out.println(Arrays.toString(bunshi_1));
// System.out.println(Arrays.toString(bunbo_1));
// System.out.println(Arrays.toString(bunshi_2));
// System.out.println(Arrays.toString(bunbo_2));
for (int i=1;i<=n+1;i++) {
// if (index_array[0]+(n-index_array[1])<i-1) {
// out.println(nCr(n+1, i));
// out.println(n1_C_i[i]);
// out.println(bunshi_1[i]*modinv(bunbo_1[i])%mod);
// } else {
// out.println(nCr(n+1, i)-nCr(index_array[0]+(n-index_array[1]), i-1));
out.println(n1_C_i[i]-n2_C_i[i-1]);
// out.println(bunshi_1[i]*modinv(bunbo_1[i])%mod-bunshi_2[i-1]*modinv(bunbo_2[i-1])%mod);
}
}
out.close();
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
}
}
| Main.java:110: error: <identifier> expected
out.close();
^
Main.java:142: error: class, interface, enum, or record expected
}
^
2 errors
|
s541117362 | p03674 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
void print(const std::vector<int> &v) {
std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
std::cout << std::endl;
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for(int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long calcComb(int n, int k) {
if(n < k)
return 0;
if(n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
int n;
cin >> n;
vector<ll> a(n + 1);
// 1からnまでの数字+1
set<int> s;
map<int, int> pos;
pair<int, int> target;
REP(i, n + 1) {
cin >> a[i];
if(s.count(a[i]) == 0) {
s.insert(a[i]);
} else {
target = make_pair(pos[a[i]], i);
}
pos[a[i]] = i;
}
COMinit();
// cout << "target.first" << target.first << " traget.second " <<
// target.second
<< endl;
// http://tutuz.hateblo.jp/entry/2018/08/03/082509
//同じ数字はちょうど1組
//重複するのはどちらから選んでいるかわからないとき
//重複するのが一つ含まれていて
//最も左よりもひだりと最も右よりも右のもの詰まる
// l-1+n-r C k-1
for(int k = 1; k <= n + 1; k++) {
ll all = calcComb(n + 1, k);
if(target.first > target.second) {
cout << "WA" << endl;
return -1;
}
ll sub = calcComb(n - target.second + target.first, k - 1);
// cout << "-----------------" << endl;
// cout << n - target.second + target.first << " " << k - 1 << endl;
// cout << all << " " << sub << endl;
ll ans = all - sub + MOD;
ans %= MOD;
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:78:5: error: expected primary-expression before '<<' token
78 | << endl;
| ^~
|
s808798742 | p03674 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int MAX_N = 100005;
ll fact[MAX_N]; // 階乗
ll ifact[MAX_N]; // 階乗の逆元
// x^nを求める繰り返し二乗法(累乗の高速化)
// フェルマーの小定理より、逆元を計算するときに用いる。
ll mod_pow(ll x, int n){
if(n == 0) return 1;
ll res = 1;
while(n > 0){
if(n & 1) res = res * x % mod;
x = x * x % mod;
n >>= 1;
}
return res;
}
// 階乗とその逆元テーブルを(0-n)まで埋める
void table(int n){
fact[0] = 1; // i^0 = 1;
for(int i = 1; i <= n; ++i){
fact[i] = fact[i - 1] * i % mod;
}
// フェルマーの小定理を利用して、右端の逆元を求める
// 階乗の(mod-2)乗
ifact[n] = mod_pow(fact[n], mod - 2);
// 逆元の性質を利用して、テーブルを埋める
for(int i = n; i >= 1; --i){
ifact[i - 1] = ifact[i] * i % mod;
}
}
// nCrを求める
ll combination(int n, int r){
if(n < 0 || r < 0 || n < r) return 0;
return fact[n] * ifact[r] % mod * ifact[n - r] % mod;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, id1 = 0, id2 = 0;
cin >> n;
vector<int> a(n+1), cnt(n+1, 0);
for(int i = 0; i < n+1; ++i){
cin >> a[i];
++cnt[a[i]];
if(cnt[a[i]] == 2) id2 = i;
}
for(int i = 0; i < n+1; ++i){
if(a[i] == a[id2]){
id1 = i;
break;
}
}
table(n+2);
// 重複している数字をxとして、xの左にある数字の個数
// a = [...x.....x...]
int num1 = id1;
// xの右側にある数字の個数
int num2 = n - id2;
ll MOD = (ll)mod
// 重複している数字:x
for(int i = 1; i <= n+1; ++i){ // 数字をi個取る
ll res = combination(n + 1, i) - combination(num1 + num2, i - 1) + 5 * MOD % mod;
cout << res << "\n";
}
} | a.cc: In function 'int main()':
a.cc:82:5: error: expected ',' or ';' before 'for'
82 | for(int i = 1; i <= n+1; ++i){ // 数字をi個取る
| ^~~
a.cc:82:20: error: 'i' was not declared in this scope
82 | for(int i = 1; i <= n+1; ++i){ // 数字をi個取る
| ^
|
s328376544 | p03674 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
//typedef long long ll;
long long po(long a, long b){
if(b==0){
return 1;
}
long long z = po(a,b/2);
z = mod(z*z);
if(b%2!=0){
z = mod(a*z);
}
return z;
}
//配列のSIZEは問題ごとに定義する必要がある。
const int SIZE=200'010
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
const int MOD=i_7;
void invinit(){//上の配列を初期化する関数。
inv[1]=1;
for(int i=2;i<=SIZE;i++){
inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
}
kai[0]=invkai[0]=1;
for(int i=1;i<=SIZE;i++){
kai[i]=(kai[i-1]*i)%MOD;
invkai[i]=(invkai[i-1]*inv[i])%MOD;
}
}
long long comb(long long a, long long b){
if(b<0 || a<b){
return 0;
}
return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}
int main(){
invinit();
int n;
cin>>n;
int a[n];
map<int,int> mp;
int fi=-1,si=-1;//2回出てくる要素の位置
REP(i,n){
cin>>a[i];
mp[a[i]]++;
if(mp[a[i]]==2){
si=i;
}
}
REP(i,n){
if(a[i]==a[si]){
fi=i;
break;
}
}
long long ans;
long long sur=0;
REPP(k,n+1){
ans = comb((long long)n+1,(long long)k);
sur = comb((long long)fi+(long long)n-1-(long long)si,(long long)k-1);
ans = mod(ans - sur);
cout<<ans<<endl;
sur = 0;
}
return 0;
}
| a.cc:29:1: error: expected ',' or ';' before 'long'
29 | long long inv[SIZE+1];//各iの逆元を格納する配列。
| ^~~~
a.cc: In function 'void invinit()':
a.cc:34:5: error: 'inv' was not declared in this scope; did you mean 'int'?
34 | inv[1]=1;
| ^~~
| int
|
s835719181 | p03674 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
//using namespace std;
//typedef long long ll;
long long po(long a, long b){
if(b==0){
return 1;
}
long long z = po(a,b/2);
z = mod(z*z);
if(b%2!=0){
z = mod(a*z);
}
return z;
}
//配列のSIZEは問題ごとに定義する必要がある。
//const int SIZE=...
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
const int MOD=i_7;
void invinit(){//上の配列を初期化する関数。
inv[1]=1;
for(int i=2;i<=SIZE;i++){
inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
}
kai[0]=invkai[0]=1;
for(int i=1;i<=SIZE;i++){
kai[i]=(kai[i-1]*i)%MOD;
invkai[i]=(invkai[i-1]*inv[i])%MOD;
}
}
long long comb(long long a, long long b){
if(b<0 || a<b){
return 0;
}
return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}
int main(){
invinit();
int n;
cin>>n;
int a[n];
map<int,int> mp;
int fi=-1,si=-1;//2回出てくる要素の位置
REP(i,n){
cin>>a[i];
mp[a[i]]++;
if(mp[a[i]]==2){
si=i;
}
}
REP(i,n){
if(a[i]==a[si]){
fi=i;
break;
}
}
long long ans;
long long sur=0;
REPP(k,n+1){
ans = comb((long long)n+1,(long long)k);
sur = comb((long long)fi+(long long)n-1-(long long)si,(long long)k-1);
ans = mod(ans - sur);
cout<<ans<<endl;
sur = 0;
}
return 0;
} | a.cc:29:15: error: 'SIZE' was not declared in this scope
29 | long long inv[SIZE+1];//各iの逆元を格納する配列。
| ^~~~
a.cc:30:15: error: 'SIZE' was not declared in this scope
30 | long long kai[SIZE+1];//i!のmodを格納する配列。
| ^~~~
a.cc:31:18: error: 'SIZE' was not declared in this scope
31 | long long invkai[SIZE+1];//各i!の逆元を格納する配列。
| ^~~~
a.cc: In function 'void invinit()':
a.cc:34:5: error: 'inv' was not declared in this scope; did you mean 'int'?
34 | inv[1]=1;
| ^~~
| int
a.cc:35:20: error: 'SIZE' was not declared in this scope
35 | for(int i=2;i<=SIZE;i++){
| ^~~~
a.cc:39:5: error: 'kai' was not declared in this scope
39 | kai[0]=invkai[0]=1;
| ^~~
a.cc:39:12: error: 'invkai' was not declared in this scope
39 | kai[0]=invkai[0]=1;
| ^~~~~~
a.cc:40:20: error: 'SIZE' was not declared in this scope
40 | for(int i=1;i<=SIZE;i++){
| ^~~~
a.cc: In function 'long long int comb(long long int, long long int)':
a.cc:50:16: error: 'kai' was not declared in this scope
50 | return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
| ^~~
a.cc:50:27: error: 'invkai' was not declared in this scope
50 | return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
| ^~~~~~
a.cc: In function 'int main()':
a.cc:56:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
56 | 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:58:3: error: 'map' was not declared in this scope
58 | map<int,int> mp;
| ^~~
a.cc:58: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:58:7: error: expected primary-expression before 'int'
58 | map<int,int> mp;
| ^~~
a.cc:62:5: error: 'mp' was not declared in this scope
62 | mp[a[i]]++;
| ^~
a.cc:79:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
79 | 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:79:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
79 | cout<<ans<<endl;
| ^~~~
| 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)
| ^~~~
|
s279130987 | p03674 | C++ | #include<iostream>
#include<map>
#include<vector>
using namespace std;
const int MAX=210000;
const long long MOD=1000000007;
typedef long long ll;
ll fac[MAX],finv[MAX],inv[MAX];
ll mod_pow(ll x, ll n){ //べき乗
ll ans=1;
while(n!=0){
if(n&1) ans=ans*x%MOD;
x=x*x%MOD;
n=n>>1;
}
return ans;
}
void com_init(){ //初期化
fac[0]=fac[1]=1;
finv[0]=finv[1]=1;
inv[1]=1;
for(int i=2;i<MAX;i++){
fac[i]=fac[i-1]*i%MOD;
//inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
//finv[i]=finv[i-1]*inv[i]%MOD;
finv[i]=finv[i-1]*mod_pow(i,MOD-2)%MOD;//フェルマーの小定理より
}
}
ll comb(ll n, ll k){ //nCk
if(n<k) return 0;
if(n<0||k<0) return 0;
return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
int main(){
com_init();
int n;
cin >> n;
vector<int> a(n+1);
map<int,int> res;
for(int i=0;i<=n;i++){
cin >> a[i];
res[a[i]]++;
}
int val;
for(auto it=res.begin();it!=res.end();it++){
if(it->second==2){
val=it->first;
}
}
int left,right;
int cnt=0;
for(int i=0;i<=n;i++){
if(a[i]==val&&cnt==0){
left=i;
cnt++;
}else if(a[i]==val&&cnt==1){
right=n-i;
}
}
for (int k = 1; k <= n+1; ++k) {
long long res = 0;
res = (res + comb(n+1, k)) % MOD;
res = (res - comb(left + n-right, k-1) + MOD) % MOD;
cout << res << endl;
}
}
}
| a.cc:74:1: error: expected declaration before '}' token
74 | }
| ^
|
s662195327 | p03674 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
#define MOD 1000000007
//int kaijo(int n){
//int ans=1;
//for(int i=2;i<=n;i++){
// ans*=i;
// ans%=MOD;
//}
//return ans;
//}
int modpow(int a,int b){
if(b==0)return 1;
if(b%2)return modpow(a,b-1)*a%MOD;
return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
//int comb(int a,int b){
//return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
//}
int kaijo[114514];
void init_kaijo(){
kaijo[0]=1;
for(int i=1;i<=114513;i++)kaijo[i]=kaijo[i-1]*i%MOD;
}
int comb(int a,int b){
if(b>a)return 0;
return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int n,l,r;
signed main(){
cin>>n;
init_kaijo();
vector<pair<int,int>>v;
rep(i,n+1){
int a;
cin>>a;
v.push_back({a,i})
}
sort(v.begin(),v.end());
rep(i,n){
if(v[i].first==v[i+1].first){
l=v[i].second,r=v[i+1].second;
break;
}
}
int s=n-(r-l);
for(int k=1;k<=n+1;k++){
cout<<(comb(n+1,k)-comb(s,k-1)+MOD)%MOD;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:39:35: error: expected ';' before '}' token
39 | v.push_back({a,i})
| ^
| ;
40 | }
| ~
|
s374425906 | p03674 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
#define MOD 1000000007
//int kaijo(int n){
//int ans=1;
//for(int i=2;i<=n;i++){
// ans*=i;
// ans%=MOD;
//}
//return ans;
//}
int modpow(int a,int b){
if(b==0)return 1;
if(b%2)return modpow(a,b-1)*a%MOD;
return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
//int comb(int a,int b){
//return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
//}
int kaijo[114514];
void init_kaijo(){
kaijo[0]=1;
for(int i=1;i<=114513;i++)kaijo[i]=kaijo[i-1]*i%MOD;
}
int comb(int a,int b){
if(b>a)return 0;
return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int n,a[114514],cnt[114514],memo,l=-1,r,dif;
int C[114514][2];
signed main(){
cin>>n;
init_kaijo();
rep(i,n+1){
cin>>a[i];
cnt[a[i]]++;
}
for(int i=1;i<=n;i++)if(cnt[i]==2)memo=i;
rep(i,n+1){
if(memo==a[i]){
if(l==-1)l=i;
else r=i;
}
}
int s=n-(r-l);
for(int k=1;k<=n+1;k++){
cout<<(comb(n+1,i)-comb1(s,i-1)+MOD)%MOD;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:49:33: error: 'i' was not declared in this scope
49 | cout<<(comb(n+1,i)-comb1(s,i-1)+MOD)%MOD;
| ^
a.cc:49:36: error: 'comb1' was not declared in this scope; did you mean 'comb'?
49 | cout<<(comb(n+1,i)-comb1(s,i-1)+MOD)%MOD;
| ^~~~~
| comb
|
s991836100 | p03674 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
#define MOD 1000000007
//int kaijo(int n){
//int ans=1;
//for(int i=2;i<=n;i++){
// ans*=i;
// ans%=MOD;
//}
/return ans;
//}
int modpow(int a,int b){
if(b==0)return 1;
if(b%2)return modpow(a,b-1)*a%MOD;
return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
//int comb(int a,int b){
//return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
//}
int kaijo[114514];
int comb(int a,int b){
return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int n,a[114514],cnt[114514],memo,l=-1,r,dif;
int C[114514][2];
signed main(){
cin>>n;
kaijo[0]=1;
for(int i=1;i<=114513;i++)kaijo[i]=kaijo[i-1]*i%MOD;
rep(i,n+1){
cin>>a[i];
cnt[a[i]]++;
}
for(int i=1;i<=n;i++)if(cnt[i]==2)memo=i;
rep(i,n+1){
if(memo==a[i]){
if(l==-1)l=i;
else r=i;
}
}
for(int k=0;k<=n+1;k++){
if(k){
if(n-(r-l)>=k-1)C[n-(r-l)][0]=comb(n-(r-l),k-1);
else C[n-(r-l)][0]=0;
}
if(n-(r-l)>=k-1)C[n+1][1]=comb(n+1,k);
}
for(int k=1;k<=n+1;k++){
int a=C[n+1][1];
int b=C[n-(r-l)][0];
cout<<(a+MOD-b)%MOD<<endl;
}
return 0;
}
| a.cc:12:9: error: expected unqualified-id before '/' token
12 | /return ans;
| ^
|
s041060168 | p03674 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
#define MOD 1000000007
int kaijo(int n){
int ans=1;
for(int i=2;i<=n;i++){
ans*=i;
ans%=MOD;
}
return ans;
}
int modpow(int a,int b){
if(b==0)return 1;
if(b%2)return modpow(a,b-1)*a%MOD;
return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
}
int n,a[114514],cnt[114514],memo,l=-1,r,dif;
int C[114514][2];
signed main(){
cin>>n;
rep(i,n+1){
cin>>a[i];
cnt[a[i]]++;
}
for(int i=1;i<=n;i++)if(cnt[i]==2)memo=i;
rep(i,n+1){
if(memo==a[i]){
if(l==-1)l=i;
else r=i;
}
}
for(int k=0;k<=n+1;k++){
if(i)C[n-(r-l)][0]=comb(n-(r-l),k-1);
if(n-(r-l)>=k-1)C[n+1][1]=0;
else C[n+1][1]=comb(n+1,k);
for(int k=1;k<=n+1;k++){
int a=C[n+1][1];
int b=C[n-(r-l)][0];
cout<<(a+MOD-b)%MOD<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:38:20: error: 'i' was not declared in this scope
38 | if(i)C[n-(r-l)][0]=comb(n-(r-l),k-1);
| ^
a.cc:47:2: error: expected '}' at end of input
47 | }
| ^
a.cc:24:14: note: to match this '{'
24 | signed main(){
| ^
|
s673212350 | p03674 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
#define MOD 1000000007
int kaijo(int n){
int ans=1;
for(int i=2;i<=n;i++){
ans*=i;
ans%=MOD;
}
return ans;
}
int modpow(int a,int b){
if(b==0)return 1;
if(b%2)return modpow(a,b-1)*a%MOD;
return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
}
int n,a[114514],cnt[114514],memo,l=-1,r,dif;
int C[114514][2];
signed main(){
cin>>n;
rep(i,n+1){
cin>>a[i];
cnt[a[i]]++;
}
for(int i=1;i<=n;i++)if(cnt[i]==2)memo=i;
rep(i,n+1){
if(memo==a[i]){
if(l==-1)l=i;
else r=i;
}
}
for(int i=0;i<=n+1;i++){
if(i)C[n-(r-l)][0]=comb(n-(r-l),k-1);
if(n-(r-l)>=k-1)C[n+1][1]=0;
else C[n+1][1]=comb(n+1,k);
for(int k=1;k<=n+1;k++){
int a=C[n+1][1];
int b=C[n-(r-l)][0];
cout<<(a+MOD-b)%MOD<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:38:49: error: 'k' was not declared in this scope
38 | if(i)C[n-(r-l)][0]=comb(n-(r-l),k-1);
| ^
a.cc:39:29: error: 'k' was not declared in this scope
39 | if(n-(r-l)>=k-1)C[n+1][1]=0;
| ^
a.cc:47:2: error: expected '}' at end of input
47 | }
| ^
a.cc:24:14: note: to match this '{'
24 | signed main(){
| ^
|
s183979301 | p03674 | C++ | #include <bits/stdc++.h>
//#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
#define all(v) v.begin(),v.end()
int kaijo(int n){
int ans=1;
for(int i=2;i<=n;i++){
ans*=i;
ans%=MOD;
}
return ans;
}
int modpow(int a,int b){
if(b==0)return 1;
if(b%2)return modpow(a,b-1)*a%MOD;
return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
}
int n,a[114514],cnt[114514],memo,l=-1,r,dif;
signed main(){
cin>>n;
rep(i,n+1){
cin>>a[i];
cnt[a[i]]++;
}
for(int i=1;i<=n;i++)if(cnt[i]==2)memo=i;
rep(i,n+1){
if(memo==a[i]){
if(l==-1)l=i;
else r=i;
}
}
dif=r-l;
for(int k=1;k<=n+1;i++){
int a=comb(n+1,k);
int b=comb(dif-1+n,k-1);
cout<<(a+MOD-b)%MOD<<endl;
}
return 0;
}
| a.cc: In function 'int kaijo(int)':
a.cc:10:22: error: 'MOD' was not declared in this scope
10 | ans%=MOD;
| ^~~
a.cc: In function 'int modpow(int, int)':
a.cc:16:39: error: 'MOD' was not declared in this scope
16 | if(b%2)return modpow(a,b-1)*a%MOD;
| ^~~
a.cc:17:44: error: 'MOD' was not declared in this scope
17 | return modpow(a,b/2)*modpow(a,b/2)%MOD;
| ^~~
a.cc: In function 'int comb(int, int)':
a.cc:20:43: error: 'MOD' was not declared in this scope
20 | return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
| ^~~
a.cc: In function 'int main()':
a.cc:37:28: error: 'i' was not declared in this scope
37 | for(int k=1;k<=n+1;i++){
| ^
a.cc:40:26: error: 'MOD' was not declared in this scope
40 | cout<<(a+MOD-b)%MOD<<endl;
| ^~~
|
s502611342 | p03674 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<unordered_map>
#include<stack>
#include<string>
#include<algorithm>
#include<functional>
#include<cstring>
#include<utility>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
/**** Type Define ****/
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Q;
/**** Const List ****/
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const ll dx[4] = { 1, 0, -1, 0 };
const ll dy[4] = { 0, -1, 0, 1 };
/**** General Functions ****/
bool primenum(ll n) {
if (n == 1) return false;
for (int i = 2; i < n; i++) {
if (i*i > n) {
break;
}
if (n%i == 0 && n != i) {
return false;
}
}
return true;
}
ll gcd(ll a, ll b) {
if (b == 0) return a;
return gcd(b, a % b);
}
ll extgcd(ll a, ll b, ll& x, ll& y) {
if (b == 0) {
x = 1, y = 0; return a;
}
ll q = a / b, g = extgcd(b, a - q * b, x, y);
ll z = x - q * y;
x = y;
y = z;
return g;
}
ll invmod(ll a, ll m) { // a^-1 mod m
ll x, y;
extgcd(a, m, x, y);
x %= m;
if (x < 0) x += m;
return x;
}
ll nCk(ll n, ll k, ll mod) {
ll ans = 1;
for (ll i = n, j = 1; j <= k; i--, j++) ans = (((ans * i) % mod) * invmod(j, mod)) % mod;
return ans;
}
ll lmin(ll a, ll b) { return a > b ? b : a; };
ll lmax(ll a, ll b) { return a > b ? a : b; };
ll lsum(ll a, ll b) { return a + b; };
/**** Zip ****/
template <typename T>
class Zip {
vector<T> d;
bool flag;
public:
Zip() {
flag = false;
}
void add(T x) {
d.push_back(x);
flag = true;
}
ll getNum(T x) { // T need to have operator < !!
if (flag) {
sort(d.begin(), d.end());
d.erase(unique(d.begin(), d.end()), d.end());
flag = false;
}
return lower_bound(d.begin(), d.end(), x) - d.begin();
}
ll size() {
if (flag) {
sort(d.begin(), d.end());
d.erase(unique(d.begin(), d.end()), d.end());
flag = false;
}
return (ll)d.size();
}
};
/**** Union Find ****/
class UnionFind {
vector<ll> par, rank; // par > 0: number, par < 0: -par
public:
void init(ll n) {
par.resize(n, 1); rank.resize(n, 0);
}
ll getSize(ll x) {
return par[find(x)];
}
ll find(ll x) {
if (par[x] > 0) return x;
return -(par[x] = -find(-par[x]));
}
void merge(ll x, ll y) {
x = find(x);
y = find(y);
if (x == y) return;
if (rank[x] < rank[y]) {
par[y] += par[x];
par[x] = -y;
}
else {
par[x] += par[y];
par[y] = -x;
if (rank[x] == rank[y]) rank[x]++;
}
}
bool isSame(ll x, ll y) {
return find(x) == find(y);
}
};
/**** Segment Tree ****/
template <typename T>
class SegmentTree {
ll n;
vector<T> node;
function<T(T, T)> fun, fun2;
bool customChange;
T outValue, initValue;
public:
void init(ll num, function<T(T, T)> resultFunction, T init, T out, function<T(T, T)> changeFunction = NULL) {
// changeFunction: (input, beforevalue) => newvalue
fun = resultFunction;
fun2 = changeFunction;
customChange = changeFunction != NULL;
n = 1;
while (n < num) n *= 2;
node.resize(2 * n - 1, init);
outValue = out;
initValue = init;
}
void valueChange(ll num, T value) {
num += n - 1;
if (customChange) node[num] = fun2(value, node[num]);
else node[num] = value;
while (num > 0) num = (num - 1) / 2, node[num] = fun(node[num * 2 + 1], node[num * 2 + 2]);
}
T rangeQuery(ll a, ll b, ll l = 0, ll r = -1, ll k = 0) { // [a, b)
if (r == -1) r = n;
if (a <= l && r <= b) return node[k];
if (b <= l || r <= a) return outValue;
ll mid = (l + r) / 2;
return fun(rangeQuery(a, b, l, mid, 2 * k + 1), rangeQuery(a, b, mid, r, 2 * k + 2));
}
};
/**** LIS ****/
ll lis(ll* a, ll n, ll* dp) {
fill(dp, dp + n, INF);//INFを代入
for (ll i = 0; i < n; i++) *lower_bound(dp, dp + n, a[i]) = a[i];
return (ll)(lower_bound(dp, dp + n, INF) - dp);
}
/**** main function ****/
ll n, ac[100001], kaburi, l, r, ff;
bool aru[100001];
int main() {
cin >> n;
for (int i = 0; i < n + 1; i++) {
aru[i] = false;
cin >> ac[i];
}
for (int i = 0; i < n + 1; i++) {
if (aru[ac[i]]) {
kaburi = ac[i];
}
else {
aru[ac[i]] = true;
}
}
for (int i = 0; i < n + 1; i++) {
if (kaburi == ac[i]) {
if (ff == 0) {
l = i;//左l
ff++;
}
else {
r = i;//右n-r
}
}
}
//0123456
//1231456 n=6
/* for(int i=1;i<=n+1;i++){
ll tyohuku=nCk(l+n-r,i-1,mod)%mod;
cout<<nCk(n+1,i,mod)%mod-tyohuku%mod<<endl;
}
ll zenbu = nCk(n + 1, 1, mod);
ll tyohuku = 1;//nCk(l+n-r,0,mod);
cout << zenbu - tyohuku << endl;
for (int k = 2; k <= n + 1; k++) {
zenbu = (((zenbu*invmod(k, mod))%mod)*(n - k + 2))%mod;
if (l + n - r >= k - 1) {
tyohuku = ((tyohuku*invmod(k - 1, mod))%mod*(l + n - r - k + 2))%mod;
}
else {
tyohuku = 0;
}
//ll tyohuku=nCk(l+n-r,i-1,mod)%mod;
//cout<<nCk(n+1,i,mod)%mod-tyohuku%mod<<endl;
cout << (zenbu%mod - tyohuku % mod) % mod << endl;
}*/
ll tyohuku,zenbu;
for (int k = 1; k <= n + 1; k++) {
if (k == 1) {
zenbu = nCk(n + 1, k, mod) % mod;
tyohuku = 1;
}
else {
zenbu=((zenbu*invmod(k,mod))%mod*(n-k+2))%mod:
tyohuku = (((tyohuku*invmod(k - 1, mod)) % mod)*(l + n - r - k + 2))%mod;
}
if (l + n - r < k - 1) {
tyohuku = 0;
}
cout << (zenbu - tyohuku) % mod << endl;
}
}
| a.cc: In function 'int main()':
a.cc:252:70: error: found ':' in nested-name-specifier, expected '::'
252 | zenbu=((zenbu*invmod(k,mod))%mod*(n-k+2))%mod:
| ^
| ::
a.cc:252:67: error: 'mod' is not a class, namespace, or enumeration
252 | zenbu=((zenbu*invmod(k,mod))%mod*(n-k+2))%mod:
| ^~~
|
s392659316 | p03674 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<unordered_map>
#include<stack>
#include<string>
#include<algorithm>
#include<functional>
#include<cstring>
#include<utility>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
/**** Type Define ****/
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Q;
/**** Const List ****/
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const ll dx[4] = {1, 0, -1, 0};
const ll dy[4] = {0, -1, 0, 1};
/**** General Functions ****/
bool primenum(ll n){
if(n==1) return false;
for(int i=2;i<n;i++){
if(i*i>n){
break;
}
if(n%i==0&&n!=i){
return false;
}
}
return true;
}
ll gcd(ll a, ll b) {
if (b == 0) return a;
return gcd(b, a % b);
}
ll extgcd(ll a, ll b, ll& x, ll& y) {
if (b == 0) {
x = 1, y = 0; return a;
}
ll q = a/b, g = extgcd(b, a - q*b, x, y);
ll z = x - q * y;
x = y;
y = z;
return g;
}
ll invmod (ll a, ll m) { // a^-1 mod m
ll x, y;
extgcd(a, m, x, y);
x %= m;
if (x < 0) x += m;
return x;
}
ll nCk(ll n, ll k, ll mod) {
ll ans = 1;
for (ll i = n, j = 1; j <= k; i--, j++) ans = (((ans * i) % mod) * invmod(j, mod)) % mod;
return ans;
}
ll lmin(ll a, ll b) { return a > b ? b : a; };
ll lmax(ll a, ll b) { return a > b ? a : b; };
ll lsum(ll a, ll b) { return a + b; };
/**** Zip ****/
template <typename T>
class Zip {
vector<T> d;
bool flag;
public:
Zip() {
flag = false;
}
void add(T x) {
d.push_back(x);
flag = true;
}
ll getNum(T x) { // T need to have operator < !!
if (flag) {
sort(d.begin(), d.end());
d.erase(unique(d.begin(), d.end()), d.end());
flag = false;
}
return lower_bound(d.begin(), d.end(), x) - d.begin();
}
ll size() {
if (flag) {
sort(d.begin(), d.end());
d.erase(unique(d.begin(), d.end()), d.end());
flag = false;
}
return (ll)d.size();
}
};
/**** Union Find ****/
class UnionFind {
vector<ll> par, rank; // par > 0: number, par < 0: -par
public:
void init(ll n) {
par.resize(n, 1); rank.resize(n, 0);
}
ll getSize(ll x) {
return par[find(x)];
}
ll find(ll x) {
if (par[x] > 0) return x;
return -(par[x] = -find(-par[x]));
}
void merge(ll x, ll y) {
x = find(x);
y = find(y);
if (x == y) return;
if (rank[x] < rank[y]) {
par[y] += par[x];
par[x] = -y;
} else {
par[x] += par[y];
par[y] = -x;
if (rank[x] == rank[y]) rank[x]++;
}
}
bool isSame(ll x, ll y) {
return find(x) == find(y);
}
};
/**** Segment Tree ****/
template <typename T>
class SegmentTree {
ll n;
vector<T> node;
function<T(T, T)> fun, fun2;
bool customChange;
T outValue, initValue;
public:
void init(ll num, function<T(T, T)> resultFunction, T init, T out, function<T(T, T)> changeFunction = NULL) {
// changeFunction: (input, beforevalue) => newvalue
fun = resultFunction;
fun2 = changeFunction;
customChange = changeFunction != NULL;
n = 1;
while (n < num) n *= 2;
node.resize(2 * n - 1, init);
outValue = out;
initValue = init;
}
void valueChange(ll num, T value) {
num += n-1;
if (customChange) node[num] = fun2(value, node[num]);
else node[num] = value;
while (num > 0) num = (num - 1) / 2, node[num] = fun(node[num * 2 + 1], node[num * 2 + 2]);
}
T rangeQuery(ll a, ll b, ll l = 0, ll r = -1, ll k = 0) { // [a, b)
if (r == -1) r = n;
if (a <= l && r <= b) return node[k];
if (b <= l || r <= a) return outValue;
ll mid = (l + r) / 2;
return fun(rangeQuery(a, b, l, mid, 2*k+1), rangeQuery(a, b, mid, r, 2*k+2));
}
};
/**** LIS ****/
ll lis(ll* a, ll n, ll* dp) {
fill(dp, dp + n, INF);//INFを代入
for (ll i = 0; i < n; i++) *lower_bound(dp, dp + n, a[i]) = a[i];
return (ll)(lower_bound(dp, dp + n, INF) - dp);
}
/**** main function ****/
ll n,ac[100001],kaburi,l,r,ff;
bool aru[100001];
int main(){
cin>>n;
for(int i=0;i<n+1;i++){
aru[i]=false;
cin>>ac[i];
}
for(int i=0;i<n+1;i++){
if(aru[ac[i]]){
kaburi=ac[i];
}else{
aru[ac[i]]=true;
}
}
for(int i=0;i<n+1;i++){
if(kaburi==ac[i]){
if(ff==0){
l=i;
ff++;
}else{
r=i;
}
}
}
/* for(int i=1;i<=n+1;i++){
ll tyohuku=nCk(l+n-r,i-1,mod)%mod;
cout<<nCk(n+1,i,mod)%mod-tyohuku%mod<<endl;
}*/
ll zenbu=nCk(n+1,1,mod);
ll tyohuku=1;//nCk(l+n-r,0,mod);
cout<<zenbu-tyohuku<<endl;
for(int i=2;i<=n+1;i++){
zenbu=(zenbu%mod)*(((invmod(i,mod)%mod)*(n-i+2)%mod)%mod)%mod);
if(l+n-r>=i-1){
tyohuku=(tyohuku%mod)*(((invmod(i-1,mod)%mod)*(l+n-r-i+2)%mod)%mod)%mod;
}else{
tyohuku=0;
}
//ll tyohuku=nCk(l+n-r,i-1,mod)%mod;
//cout<<nCk(n+1,i,mod)%mod-tyohuku%mod<<endl;
cout<<(zenbu%mod-tyohuku%mod)%mod<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:227:78: error: expected ';' before ')' token
227 | zenbu=(zenbu%mod)*(((invmod(i,mod)%mod)*(n-i+2)%mod)%mod)%mod);
| ^
| ;
|
s285881979 | p03674 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const ll MOD=1e9+7;
ll factorial[200010];
ll inverse_factorial[200010];
ll add(ll x, ll y){return (x+y)%MOD;}
ll mlt(ll x, ll y){return (x*y)%MOD;}
ll sbt(ll x, ll y){return (MOD+(x-y)%MOD)%MOD;}
ll power(int x, int n){
ll v=1;
while(n>0){
if(n%2!=0)v=mlt(v, x);
x=mlt(x,x);
n/=2;
}
return v;
}
ll inv(ll x){return power(x, MOD-2);}
void fct(){
factorial[0]=1;
for (int i=0;i<200009;++i){factorial[i+1]=mlt(factorial[i], i+1);}
}
void ifct(){
inverse_factorial[200009]=inv(factorial[200009]);
for (int i=200009;i>=1;--i){
inverse_factorial[i-1]=mlt(inverse_factorial[i],i);
}
}
ll comb(int n, int k){
if (n<0|| k<0|| k>n)return 0;
return mlt(factorial[n], mlt(inverse_factorial[n-k], inverse_factorial[k]));
}
int main(){
int n;cin>>n;
vi a;map<int, vi> table;
for (int i=0;i<n+1;++i){
int a_;cin>>a_;a.push_back(a_);
table[a_].push_back(i);
int m=table[a_].size();
if(m==2) break;
}
int p=table[a_][0], q=table[a_][1];
int l=n-q+p, m=q-p-1;
for (int k=1;k<=n+1;++k){
ll ans=comb(n-1, k);
ans=add(ans, comb(l, k-1));
ans=add(ans, 2*(sbt(comb(n-1, k-1),comb(l, k-1))));
ans=add(ans, comb(n-2, k-2));
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:53:15: error: 'a_' was not declared in this scope; did you mean 'a'?
53 | int p=table[a_][0], q=table[a_][1];
| ^~
| a
a.cc:54:11: error: 'q' was not declared in this scope
54 | int l=n-q+p, m=q-p-1;
| ^
|
s497776284 | p03674 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const ll MOD=1e9+7;
ll factorial[200010];
ll inverse_factorial[200010];
ll add(ll x, ll y){return (x+y)%MOD;}
ll mlt(ll x, ll y){return (x*y)%MOD;}
ll sbt(ll x, ll y){return (MOD+(x-y)%MOD)%MOD;}
ll power(int x, int n){
ll v=1;
while(n>0){
if(n%2!=0)v=mlt(v, x);
x=mlt(x,x);
n/=2;
}
return v;
}
ll inv(ll x){return power(x, MOD-2);}
void fct(){
factorial[0]=1;
for (int i=0;i<200009;++i){factorial[i+1]=mlt(factorial[i], i+1);}
}
void ifct(){
inverse_factorial[200009]=inv(factorial[200009]);
for (int i=200009;i>=1;--i){
inverse_factorial[i-1]=mlt(inverse_factorial[i],i);
}
}
ll comb(int n, int k){
if (n<0|| k<0|| k>n)return 0;
return mlt(factorial[n], mlt(inverse_factorial[n-k], inverse_factorial[k]));
}
int main(){
int n;cin>>n;
vi a;map<int, vi> table;
for (int i=0;i<N+1;++i){
int a_;cin>>a_;a.push_back(a_);
table[a_].push_back(i);
int m=table[a_].size();
if(m==2) break;
}
int p=table[a_][0], q=table[a_][1];
int l=n-q+p, m=q-p-1;
for (int k=1;k<=n+1;++k){
ll ans=comb(n-1, k);
ans=add(ans, comb(l, k-1));
ans=add(ans, 2*(sbt(comb(n-1, k-1),comb(l, k-1))));
ans=add(ans, comb(n-2, k-2));
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:18: error: 'N' was not declared in this scope
46 | for (int i=0;i<N+1;++i){
| ^
a.cc:53:15: error: 'a_' was not declared in this scope; did you mean 'a'?
53 | int p=table[a_][0], q=table[a_][1];
| ^~
| a
a.cc:54:11: error: 'q' was not declared in this scope
54 | int l=n-q+p, m=q-p-1;
| ^
|
s056243570 | p03674 | C | #include<stdio.h>
#define mod 1000000007
int n,i,a[100001],r,l,f[100001]={0};
long long mol(long long a,long long b){
if(b==1)return a;
if(b%2==0){
long long t=mol(a,b/2);
return (t*t)%mod;
}
return (a*mol(a,b-1))%mod;
}
long long div(long long a,long long b){
return (a*(mol(b,mod-2)))%mod;
}
long long kaijo(long long a){
if(a<1)return 1;
return (a*kaijo(a-1))%mod;
}
long long nn=kaijo(n+1);
long long nnlr=kaijo(-r+l+n);
long long ncm(int a,int b){
long long r;
if(a==n+1)r=nn;
else r=nnlr
long long rr=kaijo(b);
long long rrr=kaijo(a-b);
return div(div(r,rr)%mod,rrr)%mod;
}
int main(){
scanf("%d",&n);
for(i=0;i<=n;i++)scanf("%d",&a[i]);
for(i=0;i<=n;i++){
if(f[a[i]]==1)r=i;
f[a[i]]++;
}
for(i=0;i<=n;i++){
if(f[a[i]]==2){
l=i;
break;
}
}
for(i=1;i<=n+1;i++){
printf("%lld\n",(mod+ncm(n+1,i)-(-r+l+n>=i-1?ncm(-r+l+n,i-1):0))%mod);
}
return 0;
}
| main.c:25:14: error: initializer element is not constant
25 | long long nn=kaijo(n+1);
| ^~~~~
main.c:26:16: error: initializer element is not constant
26 | long long nnlr=kaijo(-r+l+n);
| ^~~~~
main.c: In function 'ncm':
main.c:31:28: error: expected ';' before 'long'
31 | else r=nnlr
| ^
| ;
32 | long long rr=kaijo(b);
| ~~~~
main.c:34:34: error: 'rr' undeclared (first use in this function); did you mean 'rrr'?
34 | return div(div(r,rr)%mod,rrr)%mod;
| ^~
| rrr
main.c:34:34: note: each undeclared identifier is reported only once for each function it appears in
|
s105580196 | p03674 | C++ | #include <cstdio>
#include <algorithm>
#include <iostream>
#include <functional>
#include <vector>
#include <queue>
#include <map>
#include <stack>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
int const N_MAX = 100000;
ll const MOD = 1000000007;
int n;
int a[N_MAX + 2];
ll comb[N_MAX + 2][N_MAX + 2];
int dups[N_MAX + 2];
ll dp(ll n, ll r) {
if (n < r) return 0;
if (comb[n][r]) return comb[n][r];
if (comb[n][n - r]) return comb[n][r] = comb[n][n - r];
if (r == 0) return comb[n][r] = 1;
return comb[n][r] = dp(n - 1, r - 1) + dp(n - 1, r);
}
int main() {
cin >> n;
int d;
rep(i, n + 1) {
int b;
scanf("%d", &b);
a[i] = b;
if (dups[b]) d = b;
dups[b]++;
}
vector<int> lr;
rep(i, n + 1) {
if (d == a[i]) {
lr.push_back(i);
}
}
int l = lr[0] + 1;
int r = lr[1] + 1;
FOR(k, 1, n + 1) {
printf("%lld\n", (dp(n + 1, k) - dp(l - 1 + n + 1 - r, k - 1)) % MOD);
}
printf("1\n");
}
| /tmp/ccECHb4k.o: in function `main':
a.cc:(.text+0x276): relocation truncated to fit: R_X86_64_PC32 against symbol `dups' defined in .bss section in /tmp/ccECHb4k.o
a.cc:(.text+0x298): relocation truncated to fit: R_X86_64_PC32 against symbol `dups' defined in .bss section in /tmp/ccECHb4k.o
a.cc:(.text+0x2af): relocation truncated to fit: R_X86_64_PC32 against symbol `dups' defined in .bss section in /tmp/ccECHb4k.o
collect2: error: ld returned 1 exit status
|
s952499604 | p03674 | C++ | #include "bits/stdc++.h"
using namespace std;
/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define pb push_back
/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
/* constant */
const int inf = pow(2, 62);
const int mod = 1e9 + 7;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alpha = "abcdefghijklmnopqrstuvwxyz";
/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vector<T> v){
rep(i,0,v.size() - 1){
cout << v[i] + 1 << " ";
}
cout << v[v.size() - 1] + 1 << endl;
}
/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
auto cut(T &a, int l, int r){
return T(a.begin()+l, a.begin()+r);
}
/* main */
struct binomial_coefficient{
vector<int> facts;
vector<int> invs;
int mod_pow(int x, int n, int m){
if(n== 0) return 1;
int res = mod_pow(x*x%m,n/2,m);
if(n&1) res = res*x%m;
return res;
}
int factorial(int x){
int res = 1;
rep(i,2,x+1){
res *= i;res %= mod;
}
return res;
}
int inv(int n){
return mod_pow(n,mod-2,mod);
}
void init(){
facts.push_back(1); invs.push_back(1);
for(int i = 1; i < 300005; i++){
facts.push_back(facts[i-1]*i%mod);
invs.push_back(inv(facts[i]));
}
}
int nPr(int n, int r){
if(r > n) return 0;
return (facts[n]%mod * invs[n-r]% mod)%mod;
}
int nCr(int n, int r){
if(r > n) return 0;
if(r < 0) return 0;
int ans = facts[n]%mod * invs[n-r]%mod * invs[r] % mod;
return ans;
}
int nHr(int n, int r){
if(n==0 && r==0) return 1;
return nCr(n+r-1, r);
}
};
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n = input();
vi arr; rep(i,0,n + 1) arr.push_back(input());
set<int> s;
int r;
int l;
rep(i,0,n + 1){
if(not exist(s, arr[i])){
s.insert(arr[i]);
}else{
r = i;
l = arr[r];
break;
}
}
rep(i,0,n + 1){
if(arr[i] == l){
l = i;
break;
}
}
r = n + 1 - (r + 1);
binomial_coefficient bf = binomial_coefficient();
bf.init();
rep(i,1,n + 2){
print(((bf.nCr(n + 1, i) - bf.nCr(l + r, i - 1) + mod) % mod);
}
}
| a.cc: In function 'int main()':
a.cc:154:71: error: expected ')' before ';' token
154 | print(((bf.nCr(n + 1, i) - bf.nCr(l + r, i - 1) + mod) % mod);
| ~ ^
| )
|
s251219315 | p03674 | C++ | #include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <map>
#include <cmath>
long long mod(long long a, long long b)
{
return a - long long(std::floor(double(a) / b)) * b;
}
long long power_func(long long a, long long b, long long p) {
if (b == 0) return 1;
if (b % 2 == 0){
long long d = power_func(a, b / 2, p);
return (d * d) % p;
}
//if (b % 2 == 1)
return (a*power_func(a, b - 1, p)) % p;
}
class comb_calclator {
public:
comb_calclator(int N, long long p):
N(N),
p(p),
frac_N(N + 1, 0)
{
frac_N[0] = 1;
for (int i = 1; i <= N; i++) {
frac_N[i] = (frac_N[i - 1] * i) % p;
}
}
long long comb(int n, int r) {
if ((n < 0) || (r < 0) || (n < r)) return 0;
if ((n == 0) || (r == 0)) return 1;
long long a = frac_N[n];
long long b = frac_N[r];
long long c = frac_N[n - r];
if (power_N.count(r) == 0)
power_N[r] = power_func(b, p - 2, p);
if (power_N.count(n - r) == 0)
power_N[n - r] = power_func(c, p - 2, p);
return (a * ((power_N[r] * power_N[n - r]) % p)) % p;
}
private:
int N;
long long p;
std::vector<long long> frac_N;
std::map<int, long long> power_N;
};
int main()
{
int n, N;
std::cin >> n;
N = n + 1;
//std::vector<int> A;
std::map<int, int> idx_map;
int first_idx, second_idx;
for (int i = 0; i < N; i++) {
int a;
std::cin >> a;
if (idx_map.count(a) == 0)
idx_map[a] = i;
else {
first_idx = idx_map[a];
second_idx = i;
}
}
comb_calclator cc(N, 1000000007);
int sub_N = N - second_idx + first_idx;
for (int k = 1; k < N + 1; k++) {
long long sub1 = 0;
if (k <= sub_N) {
sub1 = cc.comb(sub_N - 1, k - 1);
}
std::cout << mod((cc.comb(N, k) - sub1), 1000000007) << std::endl;
}
return 0;
}
| a.cc: In function 'long long int mod(long long int, long long int)':
a.cc:12:16: error: expected primary-expression before 'long'
12 | return a - long long(std::floor(double(a) / b)) * b;
| ^~~~
a.cc:12:15: error: expected ';' before 'long'
12 | return a - long long(std::floor(double(a) / b)) * b;
| ^~~~~
| ;
a.cc:12:16: error: expected primary-expression before 'long'
12 | return a - long long(std::floor(double(a) / b)) * b;
| ^~~~
|
s070065923 | p03674 | C++ | #include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <map>
long long mod(long long a, long long b)
{
return a - std::floor(a / b) * b;
}
long long power_func(long long a, long long b, long long p) {
if (b == 0) return 1;
if (b % 2 == 0){
long long d = power_func(a, b / 2, p);
return (d * d) % p;
}
//if (b % 2 == 1)
return (a*power_func(a, b - 1, p)) % p;
}
class comb_calclator {
public:
comb_calclator(int N, long long p):
N(N),
p(p),
frac_N(N + 1, 0)
{
frac_N[0] = 1;
for (int i = 1; i <= N; i++) {
frac_N[i] = (frac_N[i - 1] * i) % p;
}
}
long long comb(int n, int r) {
if ((n < 0) || (r < 0) || (n < r)) return 0;
if ((n == 0) || (r == 0)) return 1;
long long a = frac_N[n];
long long b = frac_N[r];
long long c = frac_N[n - r];
if (power_N.count(r) == 0)
power_N[r] = power_func(b, p - 2, p);
if (power_N.count(n - r) == 0)
power_N[n - r] = power_func(c, p - 2, p);
return (a * ((power_N[r] * power_N[n - r]) % p)) % p;
}
private:
int N;
long long p;
std::vector<long long> frac_N;
std::map<int, long long> power_N;
};
int main()
{
int n, N;
std::cin >> n;
N = n + 1;
//std::vector<int> A;
std::map<int, int> idx_map;
int first_idx, second_idx;
for (int i = 0; i < N; i++) {
int a;
std::cin >> a;
if (idx_map.count(a) == 0)
idx_map[a] = 1;
else {
first_idx = idx_map[a];
second_idx = i;
}
}
comb_calclator cc(N, 1000000007);
int sub_N = N - second_idx + first_idx;
for (int k = 1; k < N + 1; k++) {
long long sub1 = 0;
if (k <= sub_N) {
sub1 = cc.comb(sub_N - 1, k - 1);
}
std::cout << (cc.comb(N, k) - sub1) % 1000000007 << std::endl;
}
return 0;
}
| a.cc: In function 'long long int mod(long long int, long long int)':
a.cc:11:21: error: 'floor' is not a member of 'std'
11 | return a - std::floor(a / b) * b;
| ^~~~~
|
s221575121 | p03674 | C++ | #include "bits/stdc++.h" // {{{
#undef DEBUG
using namespace std;
#define outl(x) cout << (x) << '\n'
#define rep(i,n) for(int i=0; i < (int)(n); ++i)
#define ten(p) ((long long)(1e##p))
#define FILL(a,v) memset((a), (v), sizeof(a))
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define show(x) clog << #x << " \t\t= " << (x) << '\n'
#define show2(x,y) clog << '(' << #x << ',' << #y << ")\t\t= " << '(' << (x) << "\t, " << (y) << ")\n"
#define LN() fputs("\n--------------------------------\n", stderr)
#else
#define debug(...)
#define show(x)
#define show2(x,y)
#define LN()
#endif
typedef long long ll;
namespace ydk{
// }}}
#define int long long
constexpr int MX = 3 * ten(5) + 10;
constexpr int MOD = ten(9) + 7;
constexpr ll sqr(const ll &n) { return n*n; }
inline int modPow(ll n, int p)
{
if (p <= 0) return 1;
ll x = sqr(modPow(n, p/2)) % MOD;
if (p & 1) x = x*n % MOD;
return x;
}
int f[MX], finv[MX];
void init()
{
f[0] = finv[0] = 1;
for (ll i = 1; i < MX; ++i) {
f[i] = i * f[i-1] % MOD;
finv[i] = modPow(f[i], MOD-2);
}
return;
}
int combi(int n, int k)
{
if (n < k) return 0;
return 1LL * f[n] * finv[k] % MOD * finv[n-k] % MOD;
}
int p[MX];
int a[MX];
void Xx_main_xX(const signed argc, char *argv[])
{
int N;
int l, r;
init();
cin >> N;
++N;
rep(i, N) {
cin >> a[i]; --a[i];
++p[a[i]];
}
rep(i, N) {
if (p[a[i]] == 2) {
l = i;
break;
}
}
for (int i = N-1; i >= 0; i--) {
if (p[a[i]] == 2) {
r = N - i - 1;
break;
}
}
for (int i = 1; i <= N+1; ++i) {
ll ans = combi(N, i) - combi(l+r, i-1) % MOD;
outl(ans);
}
return;
}
} // {{{
signed main(signed argc, char *argv[])
{
ydk::Xx_main_xX(argc, argv); return 0;
} // }}}
#include "bits/stdc++.h" // {{{
#undef DEBUG
using namespace std;
#define outl(x) cout << (x) << '\n'
#define rep(i,n) for(int i=0; i < (int)(n); ++i)
#define ten(p) ((long long)(1e##p))
#define FILL(a,v) memset((a), (v), sizeof(a))
#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define show(x) clog << #x << " \t\t= " << (x) << '\n'
#define show2(x,y) clog << '(' << #x << ',' << #y << ")\t\t= " << '(' << (x) << "\t, " << (y) << ")\n"
#define LN() fputs("\n--------------------------------\n", stderr)
#else
#define debug(...)
#define show(x)
#define show2(x,y)
#define LN()
#endif
typedef long long ll;
namespace ydk{
// }}}
#define int long long
constexpr int MX = 3 * ten(5) + 10;
constexpr int MOD = ten(9) + 7;
constexpr ll sqr(const ll &n) { return n*n; }
inline int modPow(ll n, int p)
{
if (p <= 0) return 1;
ll x = sqr(modPow(n, p/2)) % MOD;
if (p & 1) x = x*n % MOD;
return x;
}
int f[MX], finv[MX];
void init()
{
f[0] = finv[0] = 1;
for (ll i = 1; i < MX; ++i) {
f[i] = i * f[i-1] % MOD;
finv[i] = modPow(f[i], MOD-2);
}
return;
}
int combi(int n, int k)
{
if (n < k) return 0;
return 1LL * f[n] * finv[k] % MOD * finv[n-k] % MOD;
}
int p[MX];
int a[MX];
void Xx_main_xX(const signed argc, char *argv[])
{
int N;
int l, r;
init();
cin >> N;
++N;
rep(i, N) {
cin >> a[i]; --a[i];
++p[a[i]];
}
rep(i, N) {
if (p[a[i]] == 2) {
l = i;
break;
}
}
for (int i = N-1; i >= 0; i--) {
if (p[a[i]] == 2) {
r = N - i - 1;
break;
}
}
for (int i = 1; i <= N+1; ++i) {
ll ans = combi(N, i) - combi(l+r, i-1) % MOD;
outl(ans);
}
return;
}
} // {{{
signed main(signed argc, char *argv[])
{
ydk::Xx_main_xX(argc, argv); return 0;
} // }}}
| a.cc:127:15: error: redefinition of 'constexpr const long long int ydk::MX'
127 | constexpr int MX = 3 * ten(5) + 10;
| ^~
a.cc:25:15: note: 'constexpr const long long int ydk::MX' previously defined here
25 | constexpr int MX = 3 * ten(5) + 10;
| ^~
a.cc:129:15: error: redefinition of 'constexpr const long long int ydk::MOD'
129 | constexpr int MOD = ten(9) + 7;
| ^~~
a.cc:27:15: note: 'constexpr const long long int ydk::MOD' previously defined here
27 | constexpr int MOD = ten(9) + 7;
| ^~~
a.cc:131:14: error: redefinition of 'constexpr ll ydk::sqr(const ll&)'
131 | constexpr ll sqr(const ll &n) { return n*n; }
| ^~~
a.cc:29:14: note: 'constexpr ll ydk::sqr(const ll&)' previously defined here
29 | constexpr ll sqr(const ll &n) { return n*n; }
| ^~~
a.cc:133:12: error: redefinition of 'long long int ydk::modPow(ll, long long int)'
133 | inline int modPow(ll n, int p)
| ^~~~~~
a.cc:31:12: note: 'long long int ydk::modPow(ll, long long int)' previously defined here
31 | inline int modPow(ll n, int p)
| ^~~~~~
a.cc:142:5: error: redefinition of 'long long int ydk::f [300010]'
142 | int f[MX], finv[MX];
| ^
a.cc:40:5: note: 'long long int ydk::f [300010]' previously declared here
40 | int f[MX], finv[MX];
| ^
a.cc:142:12: error: redefinition of 'long long int ydk::finv [300010]'
142 | int f[MX], finv[MX];
| ^~~~
a.cc:40:12: note: 'long long int ydk::finv [300010]' previously declared here
40 | int f[MX], finv[MX];
| ^~~~
a.cc:144:6: error: redefinition of 'void ydk::init()'
144 | void init()
| ^~~~
a.cc:42:6: note: 'void ydk::init()' previously defined here
42 | void init()
| ^~~~
a.cc:154:5: error: redefinition of 'long long int ydk::combi(long long int, long long int)'
154 | int combi(int n, int k)
| ^~~~~
a.cc:52:5: note: 'long long int ydk::combi(long long int, long long int)' previously defined here
52 | int combi(int n, int k)
| ^~~~~
a.cc:161:5: error: redefinition of 'long long int ydk::p [300010]'
161 | int p[MX];
| ^
a.cc:59:5: note: 'long long int ydk::p [300010]' previously declared here
59 | int p[MX];
| ^
a.cc:162:5: error: redefinition of 'long long int ydk::a [300010]'
162 | int a[MX];
| ^
a.cc:60:5: note: 'long long int ydk::a [300010]' previously declared here
60 | int a[MX];
| ^
a.cc:164:6: error: redefinition of 'void ydk::Xx_main_xX(int, char**)'
164 | void Xx_main_xX(const signed argc, char *argv[])
| ^~~~~~~~~~
a.cc:62:6: note: 'void ydk::Xx_main_xX(int, char**)' previously defined here
62 | void Xx_main_xX(const signed argc, char *argv[])
| ^~~~~~~~~~
a.cc:200:8: error: redefinition of 'int main(int, char**)'
200 | signed main(signed argc, char *argv[])
| ^~~~
a.cc:98:8: note: 'int main(int, char**)' previously defined here
98 | signed main(signed argc, char *argv[])
| ^~~~
|
s830025027 | p03674 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef int64_t llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64
#define n_max 100000
#define mod 1000000007
#define inv 1000000005
llong inverse(llong a){
llong ans=1;
llong tmp=a;
llong beki=inv;
while(beki > 0){
if(beki & 1) ans=ans*tmp % mod;
tmp*=tmp;
tmp%=mod;
beki >>=1;
}
return ans;
}
void mk_com(llong com[],llong n){
com[0]=1;
for(llong i=0; i< n ; i++){
com[i+1] = com[i] * (n-i)%mod;
com[i+1] = com[i+1] *inverse(i+1) %mod;
}
}
int main(){
llong n;
cin >> n;
int judge[n_max]={};
REP(i,n_max) judge[i] = -1;
int tmp;
llong doub;
REP(i,n){
scanf("%d",&tmp);
if(judge[tmp] != -1) doub = n+1-(i - judge[tmp] +1);
else judge[tmp] =i;
}
llong allcom[n_max];
llong subcom[n_max];
mk_com(allcom,n+1);
mk_com(subcom,doub);
if(doub==0) subcom={};
FOR(i,1,n+2){
if(i-1 <= doub) printf("%ld\n",(allcom[i] + mod - subcom[i-1])%mod );
else printf("%ld\n",allcom[i]);
}
} | a.cc: In function 'int main()':
a.cc:59:23: error: assigning to an array from an initializer list
59 | if(doub==0) subcom={};
| ~~~~~~^~~
|
s465230922 | p03674 | C++ | #include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using int128 = __int128;
using cint = cpp_int;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ull MAX = ULONG_MAX;
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run __attribute__((constructor)) def _
#define all(v) begin(v), end(v)
// Debug
#define debug(...) \
{ \
cerr << __LINE__ << ": " << #__VA_ARGS__ << " = "; \
for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] "; \
cerr << endl; \
}
// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define each(i, a) for (auto &&i : a)
#define rep(i, n) inc(i, 0, n - 1)
// Stream
#define input(a) scanf("%lld", &(a))
#define output(a) printf("%lld\n", (a))
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)
// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")
// Math
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }
def mod_pow(ll a, ll b) {
if (b == 0) return 1LL;
if (b & 1) return (a * mod_pow(a, b - 1)) % MOD;
ll half = mod_pow(a, b / 2);
return half * half % MOD;
}
def mod_comb(ll n, ll r) {
r = min(r, n - r);
ll sup = 1, sub = 1;
rep(i, r) {
sup *= n - i, sub *= i + 1;
sup %= MOD, sub %= MOD;
}
return sup * mod_pow(sub, MOD - 2) % MOD;
}
ll N, A, P[100000], L, R, S;
signed main() {
cin >> N;
rep(i, N) P[i] = -1;
rep(i, N + 1) {
cin >> A;
if(P[i] == -1) P[A - 1] = i;
else {L = P[A - 1], R = i;}
}
rep(K, N){
S = mod_comb(N + 1, K + 1)
S -= mod_comb(L - 1 + N - R, K)
cout << S << endl;
}
}
// for compilation: g++ -O3 -o _ _.cpp -std=c++17 | a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
2 | #include <boost/multiprecision/cpp_int.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s089520760 | p03674 | C++ | #include "pch.h"
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <limits.h>
using namespace std;
#define INF LLONG_MAX/3
#define inf INT_MAX/3
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int, int> P;
typedef long long ll;
int gcd(int a, int b) {
if (b == 0)return a;
return gcd(b, a%b);
}
int lcm(int a, int b) {
return a / gcd(a, b)*b;
}
int modpow(int a, int b) {
if (b == 0)return 1;
if (b == 1)return a % MOD;
if (b % 2)return modpow(a, b - 1)*a%MOD;
else return modpow(a, b / 2)*modpow(a, b / 2) % MOD;
}
int comb(int a, int b) {
if (b == 0 || a == b)return 1;
if (b == 1)return a % MOD;
return (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD;
}
int main() {
int n, a[100010], b[100010];
cin >> n;
n++;
rep(i, n) {
cin >> a[i];
b[i] = a[i];
}
sort(b, b + n);
int x = -1, y;
int m;
for (int i = 1;i < n;i++)if (b[i] == b[i - 1])m = b[i];
rep(i, n) {
if (a[i] == m) {
if (x == -1)x = i;
else y = i;
}
}
for(int i=1;i<=n;i++) {
cout << (comb(n, i) - comb(x-1+n-y,i-1)) % MOD << endl;
}
return 0;
} | a.cc:1:10: fatal error: pch.h: No such file or directory
1 | #include "pch.h"
| ^~~~~~~
compilation terminated.
|
s129116444 | p03674 | C++ | 32
525
5453
40919
237336
1107568
4272048
13884156
38567100
92561040
193536720
354817320
573166440
818809200
37158313
166803103
166803103
37158313
818809200
573166440
354817320
193536720
92561040
38567100
13884156
4272048
1107568
237336
40920
5456
528
33
1
| a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 32
| ^~
|
s193134305 | p03674 | C++ |
for(int i=1;i<=n;i++){
if(i == 1){
cout << n-1 << endl;
}else{
tmp = ncrgyaku(n,i);
l = left+right >= i-1 ? ncrgyaku(left+right,i-1): 0;
cout << (tmp - l + 2*MOD) % MOD << endl;
}
}
return 0;
}
| a.cc:2:3: error: expected unqualified-id before 'for'
2 | for(int i=1;i<=n;i++){
| ^~~
a.cc:2:15: error: 'i' does not name a type
2 | for(int i=1;i<=n;i++){
| ^
a.cc:2:20: error: 'i' does not name a type
2 | for(int i=1;i<=n;i++){
| ^
a.cc:12:3: error: expected unqualified-id before 'return'
12 | return 0;
| ^~~~~~
a.cc:13:1: error: expected declaration before '}' token
13 | }
| ^
|
s183987192 | p03674 | C++ | [Window Title]
This is an unregistered copy
[Main Instruction]
Hello! Thanks for trying out Sublime Text.
This is an unregistered evaluation version, and although the trial is untimed, a license must be purchased for continued use.
Would you like to purchase a license now?
[Purchase] [取消] | a.cc:1:1: error: expected unqualified-id before '[' token
1 | [Window Title]
| ^
|
s223391803 | p03674 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MD = 1000000007;
const int MAXN = 1e5 + 10;
ll fact[MAXN + 1];
ll invfact[MAXN + 1];
// binary exp
ll mod_pow(ll x, ll tn){
if(tn == 0) return 1;
ll res = mod_pow(x*x %MD, tn/2);
if(tn &1) res = res*x %MD; // n is odd
return res;
}
void init(int N){
fact[0] = 1;
for(int i=1;i<=N;i++) fact[i] = (fact[i-1]*i) %MD;
for(int i=1;i<=N;i++){
invfact[i] = mod_pow(fact[i], MD-2);
}
}
ll comb(int tn, int r){
if(r == 0 || tn == r) return 1;
if(tn < r) return 0;
return ((fact[tn]*invfact[r] %MD)*invfact[tn-r] + 1e9+7) %MD;
}
int main(){
cin.tie(0);
ios_base::sync_with_stdio(false);
ll n; cin >> n;
// first: value, second: id
vector<pair<ll, ll> > pa;
for(int id=1;id<=n+1;id++){
ll val; cin >> val;
pa.push_back(make_pair(val, id));
}
sort(pa.begin(), pa.end());
ll left, right;
for(int i=0;i<pa.size()-1;i++){
if(pa[i].first == pa[i+1].first){
left = pa[i].second;
right = pa[i+1].second;
}
}
ll N = n + 1;
ll M = left - 1 + N - right;
init(N);
for(int k=1;k<=n+1;k++){
/*
cout << "comb" << N << " " << k << ": " << comb(N, k) << endl;
cout << "comb" << M << " " << k-1 << ": " << comb(M, k-1) << endl;
*/
cout << comb(N, k) - comb(M, k-1) << endl;
}
} | a.cc: In function 'll comb(int, int)':
a.cc:32:60: error: invalid operands of types 'double' and 'const ll' {aka 'const long long int'} to binary 'operator%'
32 | return ((fact[tn]*invfact[r] %MD)*invfact[tn-r] + 1e9+7) %MD;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~
| | |
| | const ll {aka const long long int}
| double
|
s771344232 | p03674 | C | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MD = 1000000007;
const int MAXN = 1e5 + 10;
ll fact[MAXN + 1];
ll invfact[MAXN + 1];
// binary exp
ll mod_pow(ll x, ll tn){
if(tn == 0) return 1;
ll res = mod_pow(x*x %MD, tn/2);
if(tn &1) res = res*x %MD; // n is odd
return res;
}
void init(int N){
fact[0] = 1;
for(int i=1;i<=N;i++) fact[i] = (fact[i-1]*i) %MD;
for(int i=1;i<=N;i++){
invfact[i] = mod_pow(fact[i], MD-2);
}
}
ll comb(int tn, int r){
if(r == 0 || tn == r) return 1;
if(tn < r) return 0;
return ((fact[tn]*invfact[r] %MD)*invfact[tn-r]) %MD;
}
int main(){
cin.tie(0);
ios_base::sync_with_stdio(false);
ll n; cin >> n;
// first: value, second: id
vector<pair<ll, ll> > pa;
for(int id=1;id<=n+1;id++){
ll val; cin >> val;
pa.push_back(make_pair(val, id));
}
sort(pa.begin(), pa.end());
ll left, right;
for(int i=0;i<pa.size()-1;i++){
if(pa[i].first == pa[i+1].first){
left = pa[i].second;
right = pa[i+1].second;
}
}
ll N = n + 1;
ll M = left - 1 + N - right;
init(N);
for(int k=1;k<=n+1;k++){
/*
cout << "comb" << N << " " << k << ": " << comb(N, k) << endl;
cout << "comb" << M << " " << k-1 << ": " << comb(M, k-1) << endl;
*/
cout << comb(N, k) - comb(M, k-1) << endl;
}
} | main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
1 | #include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s129647600 | p03674 | C++ | #include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
ll powmod(ll x,ll n){
if(n == 0)return 1;
if(n & 1)return x * powmod(x,n-1) % MOD;
else return powmod(x*x % MOD, k/2);
}
ll divmod(ll a,ll b){
return ((a%MOD) * (powmod(b,MOD-2)%MOD)) % MOD;
}
main(){
int N;
cin >> N;
N++;
vector<int> A(N);
set<int> st;
int l,r;
for(int i = 0;i < N;i++){
cin >> A[i];
if(!st.insert(A[i]).second)r = i;
}
for(int i = 0;i < N;i++)if(A[i] == A[r]){
l = i;
break;
}
vector<ll> t1(N),t2(N);
int m = N - (r - l + 1);
//cout << l << " " << r << " " << m<< endl;
t1[0] = N;
t2[0] = 1;
for(int i = 2;i <= N;i++){
t1[i-1] = divmod((N-i+1) * t1[i-2],i);
}
for(int i = 1;i <= m;i++){
t2[i] = divmod((m-i+1) * t2[i-1],i);
}
for(int i = 0;i < N;i++){
cout << t1[i] - t2[i] << endl;
}
}
| a.cc: In function 'll powmod(ll, ll)':
a.cc:9:38: error: 'k' was not declared in this scope
9 | else return powmod(x*x % MOD, k/2);
| ^
a.cc: At global scope:
a.cc:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
14 | main(){
| ^~~~
|
s206026232 | p03674 | C++ | #include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
ll powmod(ll x,ll n){
if(n == 0)return 1;
if(n & 1)return x * powmod(x,n-1) % MOD;
eles return powmod(x*x % MOD, k/2);
}
ll divmod(ll a,ll b){
return ((a%MOD) * (powmod(b,MOD-2)%MOD)) % MOD;
}
main(){
int N;
cin >> N;
N++;
vector<int> A(N);
set<int> st;
int l,r;
for(int i = 0;i < N;i++){
cin >> A[i];
if(!st.insert(A[i]).second)r = i;
}
for(int i = 0;i < N;i++)if(A[i] == A[r]){
l = i;
break;
}
vector<ll> t1(N),t2(N);
int m = N - (r - l + 1);
//cout << l << " " << r << " " << m<< endl;
t1[0] = N;
t2[0] = 1;
for(int i = 2;i <= N;i++){
t1[i-1] = divmod((N-i+1) * t1[i-2],i);
}
for(int i = 1;i <= m;i++){
t2[i] = divmod((m-i+1) * t2[i-1],i);
}
for(int i = 0;i < N;i++){
cout << t1[i] - t2[i] << endl;
}
} | a.cc: In function 'll powmod(ll, ll)':
a.cc:9:5: error: 'eles' was not declared in this scope
9 | eles return powmod(x*x % MOD, k/2);
| ^~~~
a.cc: At global scope:
a.cc:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
14 | main(){
| ^~~~
a.cc: In function 'll powmod(ll, ll)':
a.cc:10:1: warning: control reaches end of non-void function [-Wreturn-type]
10 | }
| ^
|
s314434277 | p03674 | C++ | /// referenced: https://beta.atcoder.jp/contests/abc066/submissions/2252964
#include <bits/stdc++.h>
using namespace std;
constexpr int64_t MOD = 1000000007;
int64_t Power(int64_t base, int64_t exp) {
int64_t x = 1;
while (exp) {
if (exp % 2) {
x = x * base % MOD;
}
base = base * base % MOD;
exp /= 2;
}
return x;
}
int64_t Inv(int64_t x) {
return Power(x, MOD - 2);
}
int64_t Factorial[100002],InvFact[100002];
int64_t C(int64_t n,int64_t r){
return Factorial[n]*InvFact[r]%MOD*InvFact[n-r]%MOD;
}
int main(){
int64_t n,a;
bool c[100002];
cin >> n;
for(int64_t i=1;i<=n;i++) c[i]=false;
int64_t p[100002];
int64_t x,y;
for(int64_t i=0;i<=n;i++){
cin >> a;
if(c[a]){
x=p[a];
y=i;
}
c[a]=true;
p[a]=i;
}
Factorial[0]=1;
for(int64_t i=1;i<=n+1;i++) Factorial[i]=i*Factorial[i-1]%MOD;
for(int64_t i=0;i<=n+1;i++) InvFact[i]=inv(Factorial[i]);
for(int64_t i=1;i<=n+1;i++){
int64_t ans;
ans=C(n+1,i);
if(i-1<=n-(y-x)) ans+=MOD-C(n-(y-x),i-1);
cout << (ans%MOD) << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:50:42: error: 'inv' was not declared in this scope; did you mean 'Inv'?
50 | for(int64_t i=0;i<=n+1;i++) InvFact[i]=inv(Factorial[i]);
| ^~~
| Inv
|
s354560761 | p03674 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>
#include <set>
using ll = long long;
using namespace std;
typedef unsigned long long ull;
typedef pair<ll, ll>P;
const ll MOD = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
struct etree { ll from, to, cost; };
struct people { ll v, k, year; };
struct Combination{
int mod;
vector< int64_t > mfact, rfact;
Combination(int sz, int mod) : mfact(sz + 1), rfact(sz + 1), mod(mod){
mfact[0] = 1;
for(int i = 1; i < mfact.size(); i++) {
mfact[i] = mfact[i - 1] * i % mod;
}
rfact[sz] = inv(mfact[sz]);
for(int i = sz - 1; i >= 0; i--) {
rfact[i] = rfact[i + 1] * (i + 1) % mod;
}
}
int64_t fact(int k) const{
return (mfact[k]);
}
int64_t pow(int64_t x, int64_t n) const{
int64_t ret = 1;
while(n > 0) {
if(n & 1) (ret *= x) %= mod;
(x *= x) %= mod;
n >>= 1;
}
return (ret);
}
int64_t inv(int64_t x) consym6jh,mjt{
return (pow(x, mod - 2));
}
int64_t P(int n, int r) const{
if(r < 0 || n < r) return (0);
return (mfact[n] * rfact[n - r] % mod);
}
int64_t C(int p, int q) const{
if(q < 0 || p < q) return (0);
return (mfact[p] * rfact[q] % mod * rfact[p - q] % mod);
}
int64_t H(int n, int r) const{
if(n < 0 || r < 0) return (0);
return (r == 0 ? 1 : C(n + r - 1, r));
}
};
int main() {
ll n, a[100100], cou[100100], itl, itr;
Combination comb(100100,MOD);
cin >> n;
for (int i = 1;i <= n + 1;i++) {
cin >> a[i];
if (cou[a[i]] == 0)cou[a[i]]++;
else itr = i;
}
for (int i = 1;i <= n+1;i++) {
if (a[i] == a[itr]) {
itl = i;
break;
}
}
inverse(n + 2);
for (int i = 1;i <= n + 1;i++) {
cout << (MOD + comb.C(n + 1, i) - comb.C(itl + n - itr, i - 1)) % MOD << endl;
}
} | a.cc:60:24: error: expected ';' at end of member declaration
60 | int64_t inv(int64_t x) consym6jh,mjt{
| ^
| ;
a.cc:60:26: error: 'consym6jh' does not name a type
60 | int64_t inv(int64_t x) consym6jh,mjt{
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:95:9: error: 'inverse' was not declared in this scope
95 | inverse(n + 2);
| ^~~~~~~
|
s860477740 | p03674 | C++ | #include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <string>
using namespace std;
typedef pair<int, int> P;
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n) FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define _1 first
#define _2 second
#define pb push_back
#define mod 1000000007
#define INF 105000000000
const int maxn = 1e5 + 10;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n; cin >> n;
int a;
int check[maxn];
int idx1, idx2;
memset(check, -1, sizeof check);
rep(i, n + 1)
{
cin >> a;
if (check[a] != -1)
{
idx1 = check[a];
idx2 = i;
break;
}
else {
check[a] = i;
}
}
int l = idx1, r = n - idx2;
ll zentai=1;
ll tyouhuku=1;
FOR(k, 1, n + 2)
{
zentai = zentai*(n + 2 - k) / k;
//Print(zentai);
if (k == 1) tyouhuku = 1;
else if (k - 1 > l + r)tyouhuku = 0;
else tyouhuku = tyouhuku*(l + r + 1 - (k - 1)) / (k - 1);
if (k == 1)
{
Print(n);
continue;
}
//Print(tyouhuku);
Print((zentai - tyouhuku) % mod);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:61:9: error: 'memset' was not declared in this scope
61 | memset(check, -1, sizeof check);
| ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
14 | #include <functional>
+++ |+#include <cstring>
15 | #include <string>
|
s374249032 | p03674 | C++ | #include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
using namespace std;
typedef pair<int, int> P;
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n) FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define _1 first
#define _2 second
#define pb push_back
#define mod 1000000007
#define INF 105000000000
const int maxn = 1e5 + 10;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n; cin >> n;
int a;
int check[maxn];
int idx1, idx2;
memset(check, -1, sizeof check);
rep(i, n + 1)
{
cin >> a;
if (check[a] != -1)
{
idx1 = check[a];
idx2 = i;
break;
}
else {
check[a] = i;
}
}
int l = idx1, r = n - idx2;
ll zentai=1;
ll tyouhuku=1;
FOR(k, 1, n + 2)
{
zentai = zentai*(n + 2 - k) / k;
//Print(zentai);
if (k == 1) tyouhuku = 1;
else if (k - 1 > l + r)tyouhuku = 0;
else tyouhuku = tyouhuku*(l + r + 1 - (k - 1)) / (k - 1);
if (k == 1)
{
Print(n);
continue;
}
//Print(tyouhuku);
Print((zentai - tyouhuku) % mod);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:60:9: error: 'memset' was not declared in this scope
60 | memset(check, -1, sizeof check);
| ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
14 | #include <functional>
+++ |+#include <cstring>
15 |
|
s423383647 | p03674 | C++ | ll fact[100002], factInv[100002];
//フェルマーの小定理
ll power(ll x) {
ll res = 1, n = MOD - 2;
while(n > 0) {
if (n & 1) res = (res * x) % MOD;
x = (x * x) % MOD;
n >>= 1;
}
return res;
}
void factrial() {
fact[0] = factInv[0] = 1;
repl(i, 1, 100002) {
fact[i] = (fact[i - 1] * i) % MOD;
factInv[i] = power(fact[i]);
}
}
int main(){
cin.sync_with_stdio(false);
ll n;
cin >> n;
int a, b[n] = {};
rep(i, n) b[i] = -1;
int l, r;
rep(i, n + 1) {
cin >> a;
if (b[a - 1] != -1) l = b[a - 1], r = i;
else b[a - 1] = i;
}
factrial();
int p = n + 1 - (r - l + 1);
repl(i, 1, n + 2) {
ll g = (((fact[n + 1] * factInv[i]) % MOD) * factInv[n + 1 - i]) % MOD;
ll h = (p < i - 1) ? 0 : (((fact[p] * factInv[i - 1]) % MOD) * factInv[p - i + 1]) % MOD;
cout << (g - h + MOD) % MOD << endl;
}
return 0;
}
| a.cc:1:1: error: 'll' does not name a type
1 | ll fact[100002], factInv[100002];
| ^~
a.cc:3:1: error: 'll' does not name a type
3 | ll power(ll x) {
| ^~
a.cc: In function 'void factrial()':
a.cc:14:5: error: 'fact' was not declared in this scope
14 | fact[0] = factInv[0] = 1;
| ^~~~
a.cc:14:15: error: 'factInv' was not declared in this scope
14 | fact[0] = factInv[0] = 1;
| ^~~~~~~
a.cc:15:10: error: 'i' was not declared in this scope
15 | repl(i, 1, 100002) {
| ^
a.cc:15:5: error: 'repl' was not declared in this scope
15 | repl(i, 1, 100002) {
| ^~~~
a.cc: In function 'int main()':
a.cc:22:5: error: 'cin' was not declared in this scope
22 | cin.sync_with_stdio(false);
| ^~~
a.cc:23:5: error: 'll' was not declared in this scope
23 | ll n;
| ^~
a.cc:24:12: error: 'n' was not declared in this scope
24 | cin >> n;
| ^
a.cc:26:9: error: 'i' was not declared in this scope
26 | rep(i, n) b[i] = -1;
| ^
a.cc:26:5: error: 'rep' was not declared in this scope
26 | rep(i, n) b[i] = -1;
| ^~~
a.cc:35:5: error: 'repl' was not declared in this scope
35 | repl(i, 1, n + 2) {
| ^~~~
|
s328050713 | p03674 | C++ | #include <iostream>
#include <vector>
using namespace std;
int NN[100002];
long long int dp[2][100002];
long long int dpse[2][100002];
const int MOD = 1000000007;
long long int kaizyo(long long int n) { // n!
if (n == 1 || n == 0) return (long long int)1;
else return (long long int)((n * kaizyo(n - 1)) % MOD);
}
long long int ruizyo(long long int n, long long int m) { // n^m
if (m == 1) return (long long int)n % MOD;
else if (m % 2 == 0) {
return (long long int)(ruizyo(((n * n) % MOD), m / 2) % MOD);
}
else {
return (long long int)((n * ruizyo(n, m - 1)) % MOD);
}
}
int combination(int n, int m) {
/*for (int i = 0; i <= n; i++) { // iC?
for (int j = 0; j <= i; j++) { // iCj
dp[1][j] = dp[0][j - 1] + dp[0][j];
}
swap(dp[0], dp[1]);
}
return dp[0][m];*/
if (n < m || m < 0) return 0;
return (((kaizyo(n) * ruizyo(kaizyo(m), MOD - 2)) % MOD) * ruizyo(kaizyo(n - m), MOD - 2)) % MOD;
}
/*long combination(int m, int n) {
long long int c = 1;
m = (n - m < m ? n - m : m);
for (int ns = n - m + 1, ms = 1; ms <= m; ns++, ms++) {
c *= ns;
c /= ms;
}
return c;
}*/
int main()
{
int n = 0;
cin >> n;
vector<int> a(n+2);
a[0] = -1;
for (int i = 1; i <= n+1; i++) {
cin >> a[i];
}
memset(NN, 0, sizeof(NN));
memset(dp, 0, sizeof(dp));
memset(dpse, 0, sizeof(dpse));
int snum = 0;
int endnum = 0;
for (int i = 1; i <= n + 1; i++) {
if (NN[a[i]] == 0) NN[a[i]] = i;
else {
snum = NN[a[i]];
endnum = i;
break;
}
}
int l = snum - 1 + (n + 1 - endnum);
/*for (int i = 1; i <= l; i++) { //全長i,lまで
dpse[1][1] = i;
for (int j = 2; j <= n + 1; j++) {
dpse[1][j] = dpse[0][j - 1] + dpse[0][j];
}
swap(dpse[1], dpse[0]);
}*/
/*for (int i = 1; i <= n + 1; i++) { //全長i,n+1まで
dp[1][1] = i;
for (int j = 2; j <= n + 1; j++) {
dp[1][j] = dp[0][j - 1] + dp[0][j];
}
if (i == l) {
for (int j = 0; j <= n + 1; j++) {
dpse[0][j] = dp[1][j];
}
}
swap(dp[1], dp[0]);
}
cout << n << endl; // k=1
long long int ans = 0;
for (int i = 2; i <= n + 1; i++) {
ans = dp[0][i];
ans -= dpse[0][i - 1];
cout << ans % 1000000007 << endl; // i行目
//cout << i << "," << dpse[0][i - 1] << endl;
}*/
cout << n << endl;
for (int i = 2; i <= n+1; i++) {
cout << combination(n + 1, i) - combination(l, i - 1) << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:60:9: error: 'memset' was not declared in this scope
60 | memset(NN, 0, sizeof(NN));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | using namespace std;
|
s333554329 | p03674 | C++ | #include <iostream>
#include <vector>
using namespace std;
int NN[100002];
long long int dp[2][100002];
long long int dplong[2][100002];
long long int dpse[2][100002];
long long int dpselong[2][100002];
int main()
{
int n = 0;
cin >> n;
vector<int> a(n+2);
a[0] = -1;
for (int i = 1; i <= n+1; i++) {
cin >> a[i];
}
memset(NN, 0, sizeof(NN));
memset(dp, 0, sizeof(dp));
memset(dplong, 0, sizeof(dplong));
memset(dpse, 0, sizeof(dpse));
int snum = 0;
int endnum = 0;
for (int i = 1; i <= n + 1; i++) {
if (NN[a[i]] == 0) NN[a[i]] = i;
else {
snum = NN[a[i]];
endnum = i;
break;
}
}
int l = snum - 1 + (n + 1 - endnum);
for (int i = 1; i <= l; i++) { //全長i,lまで
dpse[1][1] = i;
for (int j = 2; j <= n + 1; j++) {
dpse[1][j] = dpse[0][j - 1] + dpse[0][j];
}
swap(dpse[1], dpse[0]);
}
for (int i = 1; i <= n + 1; i++) { //全長i,n+1まで
dp[1][1] = i;
for (int j = 2; j <= n + 1; j++) {
dp[1][j] = dp[0][j - 1] + dp[0][j];
}
swap(dp[1], dp[0]);
}
cout << n << endl; // k=1
long long int ans = 0;
for (int i = 2; i <= n + 1; i++) {
ans = dp[0][i];
ans -= dpse[0][i - 1];
cout << ans % 1000000007 << endl; // i行目
//cout << i << "," << dpse[0][i - 1] << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:22:9: error: 'memset' was not declared in this scope
22 | memset(NN, 0, sizeof(NN));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | using namespace std;
|
s989577461 | p03674 | C++ | #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll gcd(ll a,ll b){
return b?gcd(b,a%b):a;
}
const int N=200005;
const int maxn = 1e5 + 10, MOD = 1e9 + 7;
ll pos[maxn],fac[maxn],facm[maxn];
ll quick_pow(ll a,ll n,ll p)
{
ll x = a;
ll res = 1;
while(n){
if(n & 1){
res = ((ll)res * (ll)x) % p;
}
n >>= 1;
x = ((ll)x*(ll)x) % p;
}
return res;
}
ll C(ll n,ll k){
if(k > n) return 0ll;
ll ans = fac[k]*fac[n-k]%MOD;
ans = (fac[n]*quick_pow(ans,MOD-2ll,MOD))%MOD;
return ans;
}
int main()
{
fac[0] = 1;
for(int i = 1;i < maxn;i++)
fac[i] = (fac[i-1]*i)%MOD;
ll n;
scanf("%lld", &n);
n++;
ll m, x;
for(int i = 1;i <= n;i++){
scanf("%lld", &x);
if (pos[x]){
m = n - (i - pos[x] + 1);
break;
}
pos[x] = i;
}
for(int i = 1;i <= n;i++)
printf("%lld\n", (C(n, i) - C(m, i-1)+MOD) % MOD);
return 0;
}
| a.cc:19:13: error: expected unqualified-id before numeric constant
19 | #define MOD 1000000007
| ^~~~~~~~~~
a.cc:30:28: note: in expansion of macro 'MOD'
30 | const int maxn = 1e5 + 10, MOD = 1e9 + 7;
| ^~~
|
s360389742 | p03674 | C |
#include <stdio.h>
int fact(int a){
int x = 1,y;
if(a ==0){ return(x);} else {
for (int y =1; y <= a; y++){
x = x*y;
}
}
return(x);
}
int combi(int n,int r){
int ncr;
if(r <= 0){ return 1;} else{
ncr = fact(n)/(fact(r)*fact(n-r))
return(ncr);
}
}
int main(void) {
int inputsiz,i,fmark,bmark;
fmark,bmark = 0;
scanf("%d", &inputsiz);
inputsiz++;
int input[inputsiz],check[inputsiz];
for(i=0; i < inputsiz; i++) {
check[i]=0;
}
for(i=0; i < inputsiz; i++) {
scanf("%d",&input[i]);
if (bmark == 0) {
if (check[input[i]] == 0 /*if check is empty*/) {
check[input[i]] = i+1;
} else { /*mark the i pointer and the check cell */
fmark = check[input[i]]-1;
bmark = i;
}
}
}
int result;
for (int k = 1; k < inputsiz+1; k++){
result = ( combi(inputsiz,k) - combi(fmark+inputsiz-1-bmark,k-1) )%1000000007;
if (result = 0){result = 1;}
printf("%d\n",result);
}
}
| main.c: In function 'combi':
main.c:21:42: error: expected ';' before 'return'
21 | ncr = fact(n)/(fact(r)*fact(n-r))
| ^
| ;
22 | return(ncr);
| ~~~~~~
|
s917948453 | p03674 | C++ | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long
const int Mod = 1e9 + 7, MaxN = 100005;
int n, a[MaxN], vis[MaxN];
ll fact[MaxN], rfact[MaxN];
ll quickPow(ll a, int b)
{
ll res=1;
for (;b;b>>=1,a=a*a%Mod)
if (b&1)
res=res*a%Mod;
return res;
}
ll C(int n, int m)
{
if (n<0||m<0)
return 0;
if (n<m)
return 0;
return fact[n]*rfact[m]%Mod*rfact[n-m]%Mod;
}
int main()
{
cin>>n;
fact[0]=rfact[0]=ll(1);
for (int i=1;i<MaxN;i++)
fact[i] = fact[i-1]*i%Mod;
for (int i=1;i<MaxN;i++)
rfact[i]=quickPow(fact[i],Mod-2);
int p[2];
for (int i = 1; i <= n + 1; i++)
{
scanf("%d",a+i);
if (vis[a[i]])
p[0]=vis[a[i]],p[1]=i;
vis[a[i]]=i;
}
int tot=p[0]+n-p[1];
for (int i=1;i<=n+1;i++)
{
long long ans=C(n+1,i),cur=C(tot,i-1);
ans=((ans-cur) % Mod + Mod)%Mod;
printf("%lld\n", ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:12: error: expected primary-expression before 'long'
25 | #define ll long long
| ^~~~
a.cc:48:22: note: in expansion of macro 'll'
48 | fact[0]=rfact[0]=ll(1);
| ^~
|
s200944215 | p03674 | C++ | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long
ll exp_mod(int a,int b,int p) {
ll ans=1;
ll cur=a;
while (b>0){
if (b%2==1)
ans=(ans*cur) % p;
cur=(cur*cur) % p;
b/=2;
}
return ans;
}
int main(int argc,char **argv) {
int n,x,y;
cin>>n;
map<int,int> h;
for (int i=0; i < n+1; ++i) {
int k;
cin>>k;
map<int,int> it=h.find(k);
if (it != h.end()) {
x=it->second;
y=i+1;
}
else
h[k]=i+1;
}
const int P=1000000007;
ll a=1;
ll b=1;
int exp=1;
for (int k=1;k<= n+1; ++k) {
int w=exp_mod(k,P-2,P);
a=(a*(n+2-k))%P;
a=(a*w)%P;
if (k>=2) {
b=(b*(n+x-y-k+2))%P;
b=(b*prev_exp)%P;
}
exp=w;
int c=(a-b)%P;
if (c<0)c+=P;
cout<<c;
}
return 0;
} | a.cc:37:1: error: extended character is not valid in an identifier
37 |
| ^
a.cc:61:1: error: extended character is not valid in an identifier
61 |
| ^
a.cc:37:1: error: '\U000000a0' does not name a type
37 |
| ^
|
s089878425 | p03674 | C++ | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long
ll exp_mod(int a,int b,int p) {
ll ans=1;
ll cur=a;
while (b>0){
if (b%2==1)
ans=(ans*cur) % p;
cur=(cur*cur) % p;
b/=2;
}
return ans;
}
int main(int argc,char **argv) {
int n,x,y;
cin>>n;
map<int,int> h;
for (int i=0; i < n+1; ++i) {
int k;
cin>>k;
map<int,int> it=h.find(k);
if (it != h.end()) {
x=it->second;
y=i+1;
}
else
h[k]=i+1;
}
const int P=1000000007;
ll a=1;
ll b=1;
int exp=1;
for (int k=1;k<= n+1; ++k) {
int w=exp_mod(k,P-2,P);
a=(a*(n+2-k))%P;
a=(a*w)%P;
if (k>=2) {
b=(b*(n+x-y-k+2))%P;
b=(b*prev_exp)%P;
}
exp=w;
int c=(a-b)%P;
if (c<0)c+=P;
cout<<c;
}
return 0;
} | a.cc:37:1: error: extended character is not valid in an identifier
37 |
| ^
a.cc:61:1: error: extended character is not valid in an identifier
61 |
| ^
a.cc:37:1: error: '\U000000a0' does not name a type
37 |
| ^
|
s837609107 | p03674 | C++ | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long
ll exp_mod(int a,int b,int p) {
ll ans=1;
ll cur=a;
while (b>0){
if (b%2==1)
ans=(ans*cur) % p;
cur=(cur*cur) % p;
b/=2;
}
return ans;
}
int main(int argc,char **argv) {
int n,x,y;
cin>>n;
map<int,int> h;
for (int i=0; i < n+1; ++i) {
int k;
cin>>k;
map<int,int> it=h.find(k);
if (it != h.end()) {
x=it->second;
y=i+1;
}
else
h[k]=i+1;
}
const int P=1000000007;
ll a=1;
ll b=1;
int exp=1;
for (int k=1;k<= n+1; ++k) {
int w=exp_mod(k,P-2,P);
a=(a*(n+2-k))%P;
a=(a*w)%P;
if (k>=2) {
b=(b*(n+x-y-k+2))%P;
b=(b*prev_exp)%P;
}
exp=w;
int c=(a-b)%P;
if (c<0)c+=P;
cout<<c;
}
return 0;
} | a.cc:37:1: error: extended character is not valid in an identifier
37 |
| ^
a.cc:61:1: error: extended character is not valid in an identifier
61 |
| ^
a.cc:37:1: error: '\U000000a0' does not name a type
37 |
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.