submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s003397866 | p00455 | C++ | #include<iostream>
using namespace std;
typedef struct time{
int h;
int m;
int s;
};
int main(void){
time s[3],t[3];
int st,tt,zt;
for(int i = 0; i < 3; i++){
cin >> s[i].h >> s[i].m >> s[i].s >> t[i].h >> t[i].m >> t[i].s;
}
for (int i = 0; i < 3; i++){
st = s[i].s + s[i].m * 60 + s[i].h * 60 * 60;
tt = t[i].s + t[i].m * 60 + t[i].h * 60 * 60;
zt = tt - st;
cout << zt / 3600 << " " << (zt % 3600) / 60 << " " << ((zt % 3600) % 60) << endl;
}
return 0;
} | a.cc:5:1: warning: 'typedef' was ignored in this declaration
5 | typedef struct time{
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:13:13: error: expected ';' before 's'
13 | time s[3],t[3];
| ^~
| ;
a.cc:17:24: error: 's' was not declared in this scope
17 | cin >> s[i].h >> s[i].m >> s[i].s >> t[i].h >> t[i].m >> t[i].s;
| ^
a.cc:17:54: error: 't' was not declared in this scope
17 | cin >> s[i].h >> s[i].m >> s[i].s >> t[i].h >> t[i].m >> t[i].s;
| ^
a.cc:21:22: error: 's' was not declared in this scope
21 | st = s[i].s + s[i].m * 60 + s[i].h * 60 * 60;
| ^
a.cc:22:22: error: 't' was not declared in this scope
22 | tt = t[i].s + t[i].m * 60 + t[i].h * 60 * 60;
| ^
|
s250748806 | p00455 | C++ | //============================================================================
// Name : timecard.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
int main() {
int h1,m1,s1; //Aさんの出社時刻
int h2,m2,s2; //Bさんの退社時刻
for(int i=0; i<3;i+=1){
cin >>h1>> m1 >> s1;
cin >>h2>> m2 >> s2;
int h=h2-h1;
int m=m2-m1;
int s=s2-s1;
int k =0;
if(s<0){
k=1;
s= s+ 60;
}
m =m2-m1-k;
k=0;
if(m<0){
k=1;
m= m+ 60;
}
h =h2-h1-k;
k=0;
cout <<h<<" "<< m<<" " <<s<<endl;
}
return 0; | a.cc: In function 'int main()':
a.cc:48:18: error: expected '}' at end of input
48 | return 0;
| ^
a.cc:12:12: note: to match this '{'
12 | int main() {
| ^
|
s582733532 | p00456 | Java | import java.util.Scanner;
class Main {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int w=0, k=0;
int ws[] = new int[10], ks[] = new int[10];
for(int i=0; i<10; i++)
ws[i] = in.nextInt();
for(int i=0; i<10; i++)
ks[i] = in.nextInt();
Arrays.sort(ks);
Arrays.sort(ws);
for(int i=0; i<3; i++)
w += ws[9-i];
for(int i=0; i<3; i++)
k += ks[9-i];
System.out.println(w + " " + k);
}
} | Main.java:13: error: cannot find symbol
Arrays.sort(ks);
^
symbol: variable Arrays
location: class Main
Main.java:14: error: cannot find symbol
Arrays.sort(ws);
^
symbol: variable Arrays
location: class Main
2 errors
|
s018991889 | p00456 | Java | import java.util.Scanner;
class Main {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int w=0, k=0;
int ws[] = new int[10], ks[] = new int[10];
for(int i=0; i<10; i++)
ws[i] = in.nextInt();
for(int i=0; i<10; i++)
ks[i] = in.nextInt();
Arrays.sort(ks);
Arrays.sort(ws);
for(int i=0; i<3; i++)
w += ws[9-i];
for(int i=0; i<3; i++)
k += ks[9-i];
System.out.println(w + " " + k);
}
} | Main.java:13: error: cannot find symbol
Arrays.sort(ks);
^
symbol: variable Arrays
location: class Main
Main.java:14: error: cannot find symbol
Arrays.sort(ws);
^
symbol: variable Arrays
location: class Main
2 errors
|
s356881432 | p00456 | C | #include<stdio.h>
int main(void)
{
int w[10],k[10],l,maxw=0,maxk=0,q,m,p,i;
for(l=0;l<10;l++){
scanf("%d",&w[l]);
}
for(l=0;l<10;l++){
for(p=l+1;p<10;p++){
if(w[l]<w[p]){
q=w[p];
w[p]=w[l];
w[l]=q;
}
}
}
for (l=0;l<10;l++){
scanf("%d",&k[l]);
}
for (l=0;l<10;l++){
for(p=l+1;p<10;p++){
if(k[l]<k[p]){
m=k[p];
k[p]=k[l];
k[l]=m;
}
}
}
for(i=0;i<3;i++){
maxw=maxw+w[i];
maxk=maxk+k[i];
}
printf("%d %d\n",maxw,maxk);
return 0;
| main.c: In function 'main':
main.c:34:9: error: expected declaration or statement at end of input
34 | return 0;
| ^~~~~~
|
s220751821 | p00456 | C | #include<stdio.h>
int main(void)
{
int w[10],k[10],l,maxw=0,maxk=0,q,m,p,i;
for(l=0;l<10;l++){
scanf("%d",&w[l]);
}
for(l=0;l<10;l++){
for(p=l+1;p<10;p++){
if(w[l]<w[p]){
q=w[p];
w[p]=w[l];
w[l]=q;
}
}
}
for (l=0;l<10;l++){
scanf("%d",&k[l]);
}
for (l=0;l<10;l++){
for(p=l+1;p<10;p++){
if(k[l]<k[p]){
m=k[p];
k[p]=k[l];
k[l]=m;
}
}
}
for(i=0;i<3;i++){
maxw=maxw+w[i];
maxk=maxk+k[i];
}
printf("%d %d\n",maxw,maxk);
return 0;
| main.c: In function 'main':
main.c:34:9: error: expected declaration or statement at end of input
34 | return 0;
| ^~~~~~
|
s673867288 | p00456 | C | #include <stdio.h>
#define swap(a, b) {int tmp = a; a = b; b = tmp;}
int main(void)
{
int w[10];
int k[10];
int max[3] = {0};
int i, j, k;
for (i = 0; i < 10; i++){
scanf("%d", w + i);
}
for (i = 0; i < 9; i++){
for (j = 0; j < 9 - i; j++){
if (w[j] > w[j + 1]){
swap(w[j], w[j + 1]);
}
}
}
for (i = 0; i < 10; i++){
scanf("%d", k + i);
}
for (i = 0; i < 9; i++){
for (j = 0; j < 9 - i; j++){
if (k[j] > k[j + 1]){
swap(k[j], k[j + 1]);
}
}
}
printf("%d %d", w[0] + w[1] + w[2], k[0] + k[1] + k[2]);
return 0;
} | main.c: In function 'main':
main.c:10:19: error: conflicting types for 'k'; have 'int'
10 | int i, j, k;
| ^
main.c:8:13: note: previous declaration of 'k' with type 'int[10]'
8 | int k[10];
| ^
|
s972060894 | p00456 | C | #include<stdio.h>
int main(void)
{
int i,a,max1=0,max2=0,max3=0;
int k,w;
for(i=0;i<10;i++){
scanf("%d",&a);
if(max1<a){
max3=max2;
max2=max1;
max1=a;
}else if(max2<a){
max3=max2;
max2=a;
}else if(max3<a){
max3=a;
}
w=w+max2+max1+max3;
max1=0;
max2=0;
max3=0;
for(i=0;i<10;i++){
scanf("%d",&a);
if(max1<a){
max3=max2;
max2=max1;
max1=a;
}else if(max2<a){
max3=max2;
max2=a;
}else if(max3<a){
max3=a;
}
k=w+max2+max1+max3;
printf("%d %d",w,k);
return 0;
} | main.c: In function 'main':
main.c:42:1: error: expected declaration or statement at end of input
42 | }
| ^
main.c:42:1: error: expected declaration or statement at end of input
|
s442106502 | p00456 | C | #include<stdio.h>
int main(){
int w[10],k[10],i=0,n,pre,wsum,ksum;
for(i=0;i<20;i++){
scanf("%d\n",&w[i]);
}
for(i=0;i<20;i++){
scanf("%d\n",&k[i]);
}
for(n=9;n>1;n--){
for(i=0;i<n;i++){
if(w[n-i]<w[n-i-1]){
w[n-i]=pre;
w[n-i]=w[n-i-1];
w[n-i-1]=pre;
}
}
for(n=9;n>1;n--){
for(i=0;i<n;i++){
if(k[n-i]<k[n-i-1]){
k[n-i]=pre;
k[n-i]=k[n-i-1];
k[n-i-1]=pre;
}
}
wsum = w[0]+w[1]+w[2];
ksum = k[0]+k[1]+k[2];
printf("%d %d\n",wsum,ksum);
}
return 0;
} | main.c: In function 'main':
main.c:33:1: error: expected declaration or statement at end of input
33 | }
| ^
|
s524729520 | p00456 | C | #include<stdio.h>
int main(){
int w[10],k[10],i,n,pre,wsum,ksum;
for(i=0;i<10;i++){
scanf("%d\n",&w[i]);
}
for(i=0;i<10;i++){
scanf("%d\n",&k[i]);
}
for(n=9;n>1;n--){
for(i=0;i<n;i++){
if(w[n-i]<w[n-i-1]){
w[n-i]=pre;
w[n-i]=w[n-i-1];
w[n-i-1]=pre;
}
}
for(n=9;n>1;n--){
for(i=0;i<n;i++){
if(k[n-i]<k[n-i-1]){
k[n-i]=pre;
k[n-i]=k[n-i-1];
k[n-i-1]=pre;
}
}
wsum = w[0]+w[1]+w[2];
ksum = k[0]+k[1]+k[2];
printf("%d %d\n",wsum,ksum);
}
return 0;
} | main.c: In function 'main':
main.c:33:1: error: expected declaration or statement at end of input
33 | }
| ^
|
s627355818 | p00456 | C | #include<stdio.h>
int main(){
int w[10],k[10],i,n,pre,wsum,ksum;
for(i=0;i<10;i++){
scanf("%d\n",&w[i]);
}
for(i=0;i<10;i++){
scanf("%d\n",&k[i]);
}
for(n=9;n>1;n--){
for(i=0;i<n;i++){
if(w[n-i]<w[n-i-1]){
pre=w[n-i];
w[n-i]=w[n-i-1];
w[n-i-1]=pre;
}
}
for(n=9;n>1;n--){
for(i=0;i<n;i++){
if(k[n-i]<k[n-i-1]){
pre=k[n-i];
k[n-i]=k[n-i-1];
k[n-i-1]=pre;
}
}
wsum = w[0]+w[1]+w[2];
ksum = k[0]+k[1]+k[2];
printf("%d %d\n",wsum,ksum);
}
return 0;
} | main.c: In function 'main':
main.c:33:1: error: expected declaration or statement at end of input
33 | }
| ^
|
s808804114 | p00456 | C | #include<stdio.h>
int main(){
int w[10],k[10],i,n,pre,wsum,ksum;
for(i=0;i<10;i++){
scanf("%d\n",&w[i]);
}
for(i=0;i<10;i++){
scanf("%d\n",&k[i]);
}
for(n=9;n>1;n--){
for(i=0;i<n;i++){
if(w[n-i]<w[n-i-1]){
pre=w[n-i];
w[n-i]=w[n-i-1];
w[n-i-1]=pre;
}
}
for(n=9;n>1;n--){
for(i=0;i<n;i++){
if(k[n-i]<k[n-i-1]){
pre=k[n-i];
k[n-i]=k[n-i-1];
k[n-i-1]=pre;
}
}
wsum = w[0]+w[1]+w[2];
ksum = k[0]+k[1]+k[2];
printf("%d %d\n",wsum,ksum);
return 0;
} | main.c: In function 'main':
main.c:32:1: error: expected declaration or statement at end of input
32 | }
| ^
main.c:32:1: error: expected declaration or statement at end of input
|
s893819327 | p00456 | C | #include<stdio.h>
int main(){
int w[10],k[10],i,j,tmp,ksum,wsum;
for(i=0;i<10;i++){
scanf("%d\n",&w[i]);
}
for(i=0;i<10;i++){
scanf("%d\n",&k[i]);
}
for (i = 0; i < n - 1; i++) {
for (j = n - 1; j > i; j--) {
if (w[j - 1] < w[j]) {
tmp = w[j];
w[j] = w[j - 1];
w[j - 1]= tmp;
}
if (k[j - 1] < k[j]) {
tmp = k[j];
k[j] = k[j - 1];
k[j - 1]= tmp;
}
}
}
wsum=w[0]+w[1]+w[2];
ksum=k[0]+k[1]+k[2];
printf("%d %d\n",wsum,ksum);
return 0;
} | main.c: In function 'main':
main.c:10:17: error: 'n' undeclared (first use in this function)
10 | for (i = 0; i < n - 1; i++) {
| ^
main.c:10:17: note: each undeclared identifier is reported only once for each function it appears in
|
s257831855 | p00456 | C | #include<stdio.h>
#include<stdlib.h>
int compare_int(const void *a,const void *b){
return *(int*)a - *(int*)b;
}
int main(void){
int w[10];
int k[10];
int sum_w,sum_k;
int i;
for(i = 0;i < 10;i++){
scanf("%d",&w[i]);
}
for(i = 0;i < 10;i++){
scanf("%d",&k[i]);
}
qsort(w,10,sizeof(int),compare_int);
qsort(k,10.sizeof(int),compare_int);
sum_w = w[9] + w[8] + w[7];
sum_k = k[9] + k[8] + k[7];
printf("%d %d\n",sum_w,sum_k);
return 0;
} | main.c: In function 'main':
main.c:20:17: error: invalid suffix "sizeof" on floating constant
20 | qsort(k,10.sizeof(int),compare_int);
| ^~~~~~~~~
main.c:20:27: error: expected expression before 'int'
20 | qsort(k,10.sizeof(int),compare_int);
| ^~~
main.c:20:32: error: passing argument 3 of 'qsort' makes integer from pointer without a cast [-Wint-conversion]
20 | qsort(k,10.sizeof(int),compare_int);
| ^~~~~~~~~~~
| |
| int (*)(const void *, const void *)
In file included from main.c:2:
/usr/include/stdlib.h:970:57: note: expected 'size_t' {aka 'long unsigned int'} but argument is of type 'int (*)(const void *, const void *)'
970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
| ~~~~~~~^~~~~~
main.c:20:9: error: too few arguments to function 'qsort'
20 | qsort(k,10.sizeof(int),compare_int);
| ^~~~~
/usr/include/stdlib.h:970:13: note: declared here
970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
| ^~~~~
|
s839054908 | p00456 | C | ww#include <stdio.h>
int main(){
int i,j,ws[10],ks[10],koukan;
for(i=0;i<10;i++){
scanf("%d",&ws[i]);
}
for(i=0;i<10;i++){
scanf("%d",&ks[i]);
}
for(i=0;i<10;i++){
for(j=0;j<10;j++){
if(j==9)break;
if(ws[j]>ws[j+1]){
koukan=ws[j];
ws[j]=ws[j+1];
ws[j+1]=koukan;
}
if(ks[j]>ks[j+1]){
koukan=ks[j];
ks[j]=ks[j+1];
ks[j+1]=koukan;
}
}
}
printf("%d %d\n",ws[7]+ws[8]+ws[9],ks[7]+ks[8]+ks[9]);
return 0;
} | main.c:1:3: error: stray '#' in program
1 | ww#include <stdio.h>
| ^
main.c:1:1: error: unknown type name 'ww'
1 | ww#include <stdio.h>
| ^~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | ww#include <stdio.h>
| ^
|
s428954523 | p00456 | C | #include <stdio.h>
int max(int data[]){
int i,mm=0;
for(i=0,i<10,i++){
if(data[mm]<data[i]) mm=i;
}
return mm;
}
main(){
int a[10],b[10],j,k,x,y,amax[3],bmax[3],aa=0,bb=0;
for(j=0,j<10,j++){
scanf("%d",&a[j]);
}
for(k=0,k<10,k++){
scanf("%d",&b[k]);
}
for(x=0,x<3,x++){
aa=max(a);
amax[x]=a[aa];
a[aa]=0;
}
for(y=0,y<3,y++){
bb=max(b);
bmax[y]=b[bb];
b[bb]=0;
}
printf("%d %d\n",amax[0]+amax[1]+amax[2],bmax[0]+bmax[1]+bmax[2]);
return 0;
} | main.c: In function 'max':
main.c:5:19: error: expected ';' before ')' token
5 | for(i=0,i<10,i++){
| ^
| ;
main.c:5:19: error: expected expression before ')' token
main.c: At top level:
main.c:11:1: error: return type defaults to 'int' [-Wimplicit-int]
11 | main(){
| ^~~~
main.c: In function 'main':
main.c:14:18: error: expected ';' before ')' token
14 | for(j=0,j<10,j++){
| ^
| ;
main.c:14:18: error: expected expression before ')' token
main.c:17:19: error: expected ';' before ')' token
17 | for(k=0,k<10,k++){
| ^
| ;
main.c:17:19: error: expected expression before ')' token
main.c:21:18: error: expected ';' before ')' token
21 | for(x=0,x<3,x++){
| ^
| ;
main.c:21:18: error: expected expression before ')' token
main.c:26:18: error: expected ';' before ')' token
26 | for(y=0,y<3,y++){
| ^
| ;
main.c:26:18: error: expected expression before ')' token
|
s368952127 | p00456 | C | #include <stdio.h>
int max(int data[],int n){
int i,mm=0;
for(i=0,i<n,i++){
if(data[mm]<data[i]) mm=i;
}
return mm;
}
main(){
int a[10],b[10],j,k,x,y,amax[3],bmax[3],aa=0,bb=0;
for(j=0,j<10,j++){
scanf("%d",&a[j]);
}
for(k=0,k<10,k++){
scanf("%d",&b[k]);
}
for(x=0,x<3,x++){
aa=max(a,10);
amax[x]=a[aa];
a[aa]=0;
}
for(y=0,y<3,y++){
bb=max(b,10);
bmax[y]=b[bb];
b[bb]=0;
}
printf("%d %d\n",amax[0]+amax[1]+amax[2],bmax[0]+bmax[1]+bmax[2]);
return 0;
} | main.c: In function 'max':
main.c:5:18: error: expected ';' before ')' token
5 | for(i=0,i<n,i++){
| ^
| ;
main.c:5:18: error: expected expression before ')' token
main.c: At top level:
main.c:11:1: error: return type defaults to 'int' [-Wimplicit-int]
11 | main(){
| ^~~~
main.c: In function 'main':
main.c:14:18: error: expected ';' before ')' token
14 | for(j=0,j<10,j++){
| ^
| ;
main.c:14:18: error: expected expression before ')' token
main.c:17:18: error: expected ';' before ')' token
17 | for(k=0,k<10,k++){
| ^
| ;
main.c:17:18: error: expected expression before ')' token
main.c:21:17: error: expected ';' before ')' token
21 | for(x=0,x<3,x++){
| ^
| ;
main.c:21:17: error: expected expression before ')' token
main.c:26:17: error: expected ';' before ')' token
26 | for(y=0,y<3,y++){
| ^
| ;
main.c:26:17: error: expected expression before ')' token
|
s461403399 | p00456 | C | #include <stdio.h>
#include <stdlib.h>
int main(void) {
int w[10],k[10];
int i,j,p,q,t,s;
int wsum=0,ksum=0,swap;
for(i=0;i<10;i++) {
scanf("%d\n",&w[i]);
}
for(t=0;t<10;t++){
for(j=0;j<10;j++){
if (w[j]>w[j+1]) {
swap=w[j];
w[j]=w[j+1];
w[j+1]=swap;
}
}
}
wsum=w[9]+w[8]+w[7];
for(p=0;p<10;p++){
scanf("%d\n",&k[p]);
}
for(s=0;s<10;s++){
for(q=0;q<10;q++){
if (k[q]>k[q+1]) {
swap=k[q];
k[q]=k[q+1];
k[q+1]=swap;
}
}
}
ksum=k[9]+k[8]+k[7];
printf("%d %d\n",wsum,ksum);
fclose(fpout);
return EXIT_SUCCESS;
} | main.c: In function 'main':
main.c:36:24: error: 'fpout' undeclared (first use in this function)
36 | fclose(fpout);
| ^~~~~
main.c:36:24: note: each undeclared identifier is reported only once for each function it appears in
|
s756679914 | p00456 | C | #include<stdio.h>
#include<functional>
#include<algorithm>
using namespace std;
int main()
{
int i, a[11], b[11],x=0,y=0;
for (i = 0; i < 10; i++){
scanf("%d", &a[i]);
}
for (i = 0; i < 10; i++){
scanf("%d", &b[i]);
}
sort(a, a + 10, greater<int>());
sort(b, b + 10, greater<int>());
for (i = 0; i <= 2; i++){
x += a[i];
y += b[i];
}
printf("%d %d\n", x, y);
return 0;
} | main.c:2:9: fatal error: functional: No such file or directory
2 | #include<functional>
| ^~~~~~~~~~~~
compilation terminated.
|
s823395506 | p00456 | C | int main(){
int set[20];
int ans1[10],ans2[10];
int i,j,temp1,temp2;
for(i=0;i<20;i++){
scanf("%d",&set[i]);
}
for(i=0;i<10;i++){
ans1[i]=set[i];
}
for(i=0;i<10;i++){
ans2[i]=set[10+i];
}
temp1=0,temp2=0
for(i=0;i<10;i++){
for(j=0;j<10;j++){
if(ans1[j]>ans1[i]){
ans1[j]=temp1;
ans1[j]=ans1[i];
ans1[i]=temp1;
}
if(ans2[j]>ans2[i]){
ans2[j]=temp2;
ans2[j]=ans2[i];
ans2[i]=temp2;
}
}
}
printf("%d %d",(ans1[0]+ans1[1]+ans1[2]),(ans2[0]+ans2[1]+ans2[2]));
return 0;
} | main.c: In function 'main':
main.c:6:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
6 | scanf("%d",&set[i]);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main(){
main.c:6:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
6 | scanf("%d",&set[i]);
| ^~~~~
main.c:6:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:16: error: expected ';' before 'for'
14 | temp1=0,temp2=0
| ^
| ;
15 | for(i=0;i<10;i++){
| ~~~
|
s180526267 | p00456 | C | #include <stdio.h>
int main(){
int dataarray[20];
int i,j,answer1,answer2,temp;
for(i=0;i<20;i++){
scanf("%d",&dataarray[i]);
}
for(i=0;i<10;i++){
for(j=i;j<10;j++){
if(dataarray[j]>dataarray[i]{
temp=dataarray[j];
dataarray[j]=dataarray[i];
dataarray[i]=temp;
}
if(dataarray[j+10]>dataarray[i+10]{
temp=dataarray[j+10];
dataarray[j+10]=dataarray[i+10];
dataarray[i+10]=temp;
}
}
answer1=dataarray[0]+dataarray[1]+dataarray[2];
answer2=dataarray[10]+dataarray[11]+dataarray[12];
printf("%d %d",answer1,answer2);
return 0;
} | main.c: In function 'main':
main.c:10:29: error: expected ')' before '{' token
10 | if(dataarray[j]>dataarray[i]{
| ~ ^
| )
main.c:25:1: error: expected expression before '}' token
25 | }
| ^
main.c:25:1: error: expected declaration or statement at end of input
main.c:25:1: error: expected declaration or statement at end of input
|
s614112305 | p00456 | C++ | #include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
int main(){
int ws=0,ks=0;
int data;
rep(i,10){cin>>data;ws+=data};
rep(i,10){cin>>data;ks+=data);
cout<< ws << " " <<ks << endl;
} | a.cc: In function 'int main()':
a.cc:9:37: error: expected ';' before '}' token
9 | rep(i,10){cin>>data;ws+=data};
| ^
| ;
a.cc:10:37: error: expected ';' before ')' token
10 | rep(i,10){cin>>data;ks+=data);
| ^
| ;
a.cc:12:2: error: expected '}' at end of input
12 | }
| ^
a.cc:6:11: note: to match this '{'
6 | int main(){
| ^
|
s572785769 | p00456 | C++ | include<iostream>
#include<algorithm>
using namespace std;
int main(){
int W[10],K[10];
int ans_W=0,ans_K=0;
for(int i=0;i<10;i++){
cin >> W[i];
}
for(int i=0;i<10;i++){
cin >> K[i];
}
sort(W,W+10,greater<int>());
sort(K,K+10,greater<int>());
for(int i=0;i<3;i++){
ans_W += W[i];
ans_K += K[i];
}
cout << ans_W << " " << ans_K << endl;
}
| a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
|
s291231484 | p00456 | C++ | #include<iostream>
using namespace std;
int main(){
int a[10],b[10];
for(int i=0;i<10;i++){
cin>>a[i];
}
for(int i=0;i<10;i++){
cin>>b[i];
}
sort(a,a+10);
sort(b,b+10);
cout << a[8]+a[9]+a[7] << endl;
cout << b[8]+b[9]+b[7] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(a,a+10);
| ^~~~
| short
|
s827214613 | p00456 | C++ | #include<iostream>
using namespace std;
int main(){
int a[10],b[10];
for(int i=0;i<10;i++){
cin>>a[i];
}
for(int i=0;i<10;i++){
cin>>b[i];
}
sort(a,a+10);
sort(b,b+10);
cout << a[8]+a[9]+a[7] << endl;
cout << b[8]+b[9]+b[7] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(a,a+10);
| ^~~~
| short
|
s731720510 | p00456 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main () {
int m, W[10], T[i], i;
for(i=0;i<10;i++) {
cin >> W[i];
m = max(m,W[i]);
}
cout << m << " ";
for(i=0;i<10;i++) {
cin >> T[i];
m=max(m,T[i]);
}
cout << m << endl;
} | a.cc: In function 'int main()':
a.cc:6:21: error: 'i' was not declared in this scope
6 | int m, W[10], T[i], i;
| ^
a.cc:13:16: error: 'T' was not declared in this scope
13 | cin >> T[i];
| ^
|
s972995786 | p00456 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main () {
int m=0, W[10], T[10], i;
for(i=0;i<10;i++) {
cin >> W[i];
}
sort(W,10);
for(i=7;i<10;i++)
m += W[i];
cout << m << " ";
for(i=0;i<10;i++) {
cin >> T[i];
}
sort(T,10);
for(i=7;i<10;i++)
m += T[i];
cout << m << endl;
} | a.cc: In function 'int main()':
a.cc:10:9: error: no matching function for call to 'sort(int [10], int)'
10 | sort(W,10);
| ~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: template argument deduction/substitution failed:
a.cc:10:9: note: deduced conflicting types for parameter '_RAIter' ('int*' and 'int')
10 | sort(W,10);
| ~~~~^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 2 provided
a.cc:17:9: error: no matching function for call to 'sort(int [10], int)'
17 | sort(T,10);
| ~~~~^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: template argument deduction/substitution failed:
a.cc:17:9: note: deduced conflicting types for parameter '_RAIter' ('int*' and 'int')
17 | sort(T,10);
| ~~~~^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 2 provided
|
s007406490 | p00456 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <limits.h>
//#include <windows.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
using namespace std;
typedef unsigned int uint;
typedef long long int llint;
typedef pair<llint,llint> pii;
#define mpq(T) priority_queue<T,vector<T>,greater<T> >
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define REP(i,a) for(int i = 0; i < (a); i++)
class BIT
{
private:
int s;
llint* d;
public:
BIT(int size)
{
s = size;
d = (llint*)malloc(sizeof(llint) * s);
for(int i = 0; i < s; i++)
{
d[i] = 0;
}
}
void add(int b,int x)
{
for(int i = b + 1; i <= s; i += (i & -i))
{
d[i - 1] += x;
}
}
llint sum(int b)
{
llint all = 0;
for(int i = b + 1; i > 0; i -= (i & -i))
{
all += d[i - 1];
}
return all;
}
~BIT()
{
free(d);
}
};
class unionfind
{
private:
int s;
int* o;
int* r;
public:
unionfind(int dsize)
{
s = dsize;
o = (int*)malloc(sizeof(int) * s);
r = (int*)malloc(sizeof(int) * s);
for(int i = 0; i < s; i++)
{
o[i] = i;
r[i] = 0;
}
}
int mfind(int b)
{
if(o[b] != b)
{
o[b] = mfind(o[b]);
}
return o[b];
}
void munion(int a,int b)
{
int aw = mfind(a);
int bw = mfind(b);
if(aw == bw)
{
return;
}
if(r[aw] > r[bw])
{
o[bw] = a;
}
else if(r[aw] < r[bw])
{
o[aw] = bw;
}
else
{
o[bw] = aw;
r[aw]++;
}
s--;
}
int size()
{
return s;
}
~unionfind()
{
free(o);
free(r);
}
};
template<class T> int lbound(T* d,T key,int s,int e)
{
s--;
while(e - s > 1)
{
int m = (s + e) / 2;
if(d[m] < key)
{
s = m;
}
else
{
e = m;
}
}
return e;
}
template<class T> int ubound(T* d,T key,int s,int e)
{
s--;
while(e - s > 1)
{
int m = (s + e) / 2;
if(key < d[m])
{
e = m;
}
else
{
s = m;
}
}
return e;
}
class zpress
{
private:
int ms;
pii* md;
int n;
int s;
llint* d;
int* t;
public:
zpress(int dsize = 1000000)
{
int ms = dsize;
md = (pii*)malloc(sizeof(pii) * ms);
d = (llint*)malloc(sizeof(llint) * ms);
t = (int*)malloc(sizeof(int) * ms);
n = 0;
}
void in(llint x)
{
in2(x,n);
n++;
}
void in2(llint x,int b)
{
md[b] = make_pair(x,b);
}
void syori()
{
syori2(n);
}
void syori2(int k)
{
sort(md,md + k);
llint mae = LLONG_MIN;
s = 0;
REP(i,k)
{
if(md[i].first != mae)
{
d[s] = md[i].first;
s++;
mae = md[i].first;
}
t[md[i].second] = s - 1;
}
}
llint iti(int b)
{
return t[b];
}
int size()
{
return s;
}
int first(llint x)
{
return lbound(d,x,0,s);
}
int end(llint x)
{
return ubound(d,x,0,s);;
}
~zpress()
{
free(md);
free(d);
free(t);
}
};
class xorshift
{
private:
unsigned int a,b,c,d;
public:
xorshift(unsigned int aw = 123456789,unsigned int bw = 362436069,unsigned int cw = 521288629,unsigned int dw = 88675123,unsigned int e = 97)
{
a = aw;
b = bw;
c = cw;
d = dw;
for(unsigned int i = 0; i < e; i++)
{
operator()();
}
}
unsigned int operator()()
{
unsigned int w = a ^ (a << 11);
a = b;
b = c;
c = d;
d = (d ^ (d >> 19)) ^ (w ^ (w >> 8));
return d;
}
};
llint gcd(llint a,llint b)
{
while(1)
{
llint w = a % b;
if(w == 0)
{
return b;
}
a = b;
b = w;
}
}
llint sei(llint d,llint p)
{
if(d < 0)
{
d -= ((d + 1) / p - 1) * p;
}
else
{
d %= p;
}
return d;
}
llint inv(llint a,llint p)
{
llint r0 = sei(a,p);
llint r1 = p;
llint a0 = 1;
llint b0 = 0;
llint a1 = 0;
llint b1 = 1;
while(1)
{
llint q = r0 / r1;
llint w = r0 - q * r1;
if(w == 0)
{
break;
}
r0 = r1;
r1 = w;
w = a0 - q * a1;
a0 = a1;
a1 = w;
}
return sei(a1,p);
}
template <llint P> class mod
{
private:
llint d;
public:
mod(llint a = 0)
{
d = a;
d = sei(d,P);
}
mod operator-() const
{
return mod(P - d);
}
mod operator+=(const mod& a)
{
d = d + a.d;
d = sei(d,P);
return *this;
}
mod operator-=(const mod& a)
{
return operator+=(-a);
}
mod operator*=(const mod& a)
{
d = d * a.d;
d = sei(d,P);
return *this;
}
mod operator/=(const mod& a)
{
return a * mod(inv(d,P));
}
mod operator+(const mod& a) const
{
mod w = *this;
return (w += a);
}
mod operator-(const mod& a) const
{
mod w = *this;
return (w -= a);
}
mod operator*(const mod& a) const
{
mod w = *this;
return (w *= a);
}
mod operator/(const mod& a) const
{
mod w = *this;
return (w /= a);
}
bool operator==(const mod& a) const
{
return (d == a.d);
}
bool operator!=(const mod& a) const
{
return (d != a.d);
}
operator llint() const
{
return d;
}
};
/////////////////////////////////////////////////////
FILE* fi;
FILE* fo;
void err(char* a)
{
printf("%s\n",a);
getchar();
}
llint in()
{
llint w;
fscanf(fi,"%lld",&w);
return w;
}
void ins(char* a)
{
fscanf(fi,"%s",a);
}
void out(llint a)
{
fprintf(fo,"%lld\n",a);
}
void outs(char* a)
{
fprintf(fo,"%s\n",a);
}
void func();
int main()
{
fi = stdin;
fo = stdout;
func();
return 0;
}
char s[11111];
int w[10];
int k[10];
void func()
{
REP(i,10)
{
w[i] = in();
}
REP(i,10)
{
k[i] = in();
}
sort(w);
sort(k);
char ww[100];
sprintf("%d %d",w[0] + w[1] + w[2],k[0] + k[1] + k[2]);
outs(ww);
} | a.cc: In function 'void func()':
a.cc:462:13: error: no matching function for call to 'sort(int [10])'
462 | sort(w);
| ~~~~^~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:9:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 1 provided
a.cc:463:13: error: no matching function for call to 'sort(int [10])'
463 | sort(k);
| ~~~~^~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 1 provided
a.cc:465:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
465 | sprintf("%d %d",w[0] + w[1] + w[2],k[0] + k[1] + k[2]);
| ^~~~~~~
a.cc:465:37: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
465 | sprintf("%d %d",w[0] + w[1] + w[2],k[0] + k[1] + k[2]);
| ~~~~~~~~~~~~^~~~~~
| |
| int
In file included from a.cc:1:
/usr/include/stdio.h:366:44: note: initializing argument 2 of 'int sprintf(char*, const char*, ...)'
366 | const char *__restrict __format, ...) __THROWNL;
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
|
s603436993 | p00456 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <limits.h>
//#include <windows.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
using namespace std;
typedef unsigned int uint;
typedef long long int llint;
typedef pair<llint,llint> pii;
#define mpq(T) priority_queue<T,vector<T>,greater<T> >
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define REP(i,a) for(int i = 0; i < (a); i++)
class BIT
{
private:
int s;
llint* d;
public:
BIT(int size)
{
s = size;
d = (llint*)malloc(sizeof(llint) * s);
for(int i = 0; i < s; i++)
{
d[i] = 0;
}
}
void add(int b,int x)
{
for(int i = b + 1; i <= s; i += (i & -i))
{
d[i - 1] += x;
}
}
llint sum(int b)
{
llint all = 0;
for(int i = b + 1; i > 0; i -= (i & -i))
{
all += d[i - 1];
}
return all;
}
~BIT()
{
free(d);
}
};
class unionfind
{
private:
int s;
int* o;
int* r;
public:
unionfind(int dsize)
{
s = dsize;
o = (int*)malloc(sizeof(int) * s);
r = (int*)malloc(sizeof(int) * s);
for(int i = 0; i < s; i++)
{
o[i] = i;
r[i] = 0;
}
}
int mfind(int b)
{
if(o[b] != b)
{
o[b] = mfind(o[b]);
}
return o[b];
}
void munion(int a,int b)
{
int aw = mfind(a);
int bw = mfind(b);
if(aw == bw)
{
return;
}
if(r[aw] > r[bw])
{
o[bw] = a;
}
else if(r[aw] < r[bw])
{
o[aw] = bw;
}
else
{
o[bw] = aw;
r[aw]++;
}
s--;
}
int size()
{
return s;
}
~unionfind()
{
free(o);
free(r);
}
};
template<class T> int lbound(T* d,T key,int s,int e)
{
s--;
while(e - s > 1)
{
int m = (s + e) / 2;
if(d[m] < key)
{
s = m;
}
else
{
e = m;
}
}
return e;
}
template<class T> int ubound(T* d,T key,int s,int e)
{
s--;
while(e - s > 1)
{
int m = (s + e) / 2;
if(key < d[m])
{
e = m;
}
else
{
s = m;
}
}
return e;
}
class zpress
{
private:
int ms;
pii* md;
int n;
int s;
llint* d;
int* t;
public:
zpress(int dsize = 1000000)
{
int ms = dsize;
md = (pii*)malloc(sizeof(pii) * ms);
d = (llint*)malloc(sizeof(llint) * ms);
t = (int*)malloc(sizeof(int) * ms);
n = 0;
}
void in(llint x)
{
in2(x,n);
n++;
}
void in2(llint x,int b)
{
md[b] = make_pair(x,b);
}
void syori()
{
syori2(n);
}
void syori2(int k)
{
sort(md,md + k);
llint mae = LLONG_MIN;
s = 0;
REP(i,k)
{
if(md[i].first != mae)
{
d[s] = md[i].first;
s++;
mae = md[i].first;
}
t[md[i].second] = s - 1;
}
}
llint iti(int b)
{
return t[b];
}
int size()
{
return s;
}
int first(llint x)
{
return lbound(d,x,0,s);
}
int end(llint x)
{
return ubound(d,x,0,s);;
}
~zpress()
{
free(md);
free(d);
free(t);
}
};
class xorshift
{
private:
unsigned int a,b,c,d;
public:
xorshift(unsigned int aw = 123456789,unsigned int bw = 362436069,unsigned int cw = 521288629,unsigned int dw = 88675123,unsigned int e = 97)
{
a = aw;
b = bw;
c = cw;
d = dw;
for(unsigned int i = 0; i < e; i++)
{
operator()();
}
}
unsigned int operator()()
{
unsigned int w = a ^ (a << 11);
a = b;
b = c;
c = d;
d = (d ^ (d >> 19)) ^ (w ^ (w >> 8));
return d;
}
};
llint gcd(llint a,llint b)
{
while(1)
{
llint w = a % b;
if(w == 0)
{
return b;
}
a = b;
b = w;
}
}
llint sei(llint d,llint p)
{
if(d < 0)
{
d -= ((d + 1) / p - 1) * p;
}
else
{
d %= p;
}
return d;
}
llint inv(llint a,llint p)
{
llint r0 = sei(a,p);
llint r1 = p;
llint a0 = 1;
llint b0 = 0;
llint a1 = 0;
llint b1 = 1;
while(1)
{
llint q = r0 / r1;
llint w = r0 - q * r1;
if(w == 0)
{
break;
}
r0 = r1;
r1 = w;
w = a0 - q * a1;
a0 = a1;
a1 = w;
}
return sei(a1,p);
}
template <llint P> class mod
{
private:
llint d;
public:
mod(llint a = 0)
{
d = a;
d = sei(d,P);
}
mod operator-() const
{
return mod(P - d);
}
mod operator+=(const mod& a)
{
d = d + a.d;
d = sei(d,P);
return *this;
}
mod operator-=(const mod& a)
{
return operator+=(-a);
}
mod operator*=(const mod& a)
{
d = d * a.d;
d = sei(d,P);
return *this;
}
mod operator/=(const mod& a)
{
return a * mod(inv(d,P));
}
mod operator+(const mod& a) const
{
mod w = *this;
return (w += a);
}
mod operator-(const mod& a) const
{
mod w = *this;
return (w -= a);
}
mod operator*(const mod& a) const
{
mod w = *this;
return (w *= a);
}
mod operator/(const mod& a) const
{
mod w = *this;
return (w /= a);
}
bool operator==(const mod& a) const
{
return (d == a.d);
}
bool operator!=(const mod& a) const
{
return (d != a.d);
}
operator llint() const
{
return d;
}
};
/////////////////////////////////////////////////////
FILE* fi;
FILE* fo;
void err(char* a)
{
printf("%s\n",a);
getchar();
}
llint in()
{
llint w;
fscanf(fi,"%lld",&w);
return w;
}
void ins(char* a)
{
fscanf(fi,"%s",a);
}
void out(llint a)
{
fprintf(fo,"%lld\n",a);
}
void outs(char* a)
{
fprintf(fo,"%s\n",a);
}
void func();
int main()
{
fi = stdin;
fo = stdout;
func();
return 0;
}
char s[11111];
int w[10];
int k[10];
void func()
{
REP(i,10)
{
w[i] = in();
}
REP(i,10)
{
k[i] = in();
}
sort(w);
sort(k);
char ww[100];
sprintf(ww,"%d %d",w[0] + w[1] + w[2],k[0] + k[1] + k[2]);
outs(ww);
} | a.cc: In function 'void func()':
a.cc:462:13: error: no matching function for call to 'sort(int [10])'
462 | sort(w);
| ~~~~^~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:9:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 1 provided
a.cc:463:13: error: no matching function for call to 'sort(int [10])'
463 | sort(k);
| ~~~~^~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 1 provided
|
s212411074 | p00456 | C++ | #include<iostream>
using namespace std;
int main(){
int N[11]={},W[11]={},x;
int Ns=0;Ws=0;
for(int i=0;i<9;i++)
{cin>>x;N[i]=x;}
for(int i=0;i<9;i++)
{cin>>x;W[i]=x;}
for(int i=0;i<9;i++)
{for(int j=9;j>j;j--)
{if(N[j]>N[j-1]){int t=N[j];N[j]=N[j-1];N[j-1]=t;}
if(W[j]>W[j-1]){int t=W[j];W[j]=W[j-1];W[j-1]=t;}
}
}
for(int i=0;i<3;i++)
{Ns+=N[i];Ws+=W[i];}
cout<<Ns<<" "<<Ws<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:10: error: 'Ws' was not declared in this scope; did you mean 'Ns'?
6 | int Ns=0;Ws=0;
| ^~
| Ns
|
s421414526 | p00456 | C++ | #include<iostream>
using namespace std;
int main(){
int N[11]={},W[11]={},x;
int Ns=0;Ws=0;
for(int i=0;i<9;i++)
{cin>>x;N[i]=x;}
for(int i=0;i<9;i++)
{cin>>x;W[i]=x;}
for(int i=0;i<9;i++)
{for(int j=9;j>j;j--)
{if(N[j]>N[j-1]){int t=N[j];N[j]=N[j-1];N[j-1]=t;}
if(W[j]>W[j-1]){int t=W[j];W[j]=W[j-1];W[j-1]=t;}
}
}
for(int i=0;i<3;i++)
{Ns+=N[i];Ws+=W[i];}
cout<<Ns<<" "<<Ws<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:10: error: 'Ws' was not declared in this scope; did you mean 'Ns'?
6 | int Ns=0;Ws=0;
| ^~
| Ns
|
s156663806 | p00456 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a[20];
for (int i = 0;i <= 19;i++){
cin >> a[i];
}
int w = 0;int k = 0;
for(int i = 3;i <= 9;i++){
int p = a[i];
for(int ii =0;ii <= 2;ii++){
if(p > a[ii]){
swap(a[ii],p);
}
}
}
w = a[0] + a[1] + a[2];
for(int i = 13;i <= 19;i++){
int p = a[i];
for(int ii =10;ii <= 12;ii++){
if(p > a[ii]){
swap(a[ii],p);
}
}
}
k = a[10] + a[11] + a[12];
cout >> w >>" " >> k >> endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:29:7: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
29 | cout >> w >>" " >> k >> endl;
| ~~~~ ^~ ~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:29:7: note: candidate: 'operator>>(int, int)' (built-in)
29 | cout >> w >>" " >> k >> endl;
| ~~~~~^~~~
a.cc:29:7: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:29:10: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
29 | cout >> w >>" " >> k >> endl;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:29:2: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
29 | cout >> w >>" " >> k >> endl;
| ^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:29:10: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
29 | cout >> w >>" " >> k >> endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:29:10: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
29 | cout >> w >>" " >> k >> endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:29:10: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
29 | cout >> w >>" " >> k >> endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:29:10: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
29 | cout >> w >>" " >> k >> endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:29:10: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
29 | cout >> w >>" " >> k >> endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:29:10: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
29 | cout >> w >>" " >> k >> endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]':
a.cc:29:10: required from here
29 | cout >> w >>" " >> k >> endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s801714616 | p00456 | C++ | #include <iostream>
#include <set>
using namespace std;
int main()
{
set<int> a;
int h = 0;
int hh = 0;
for (int b = 0; b < 10; b++)
{
int c;
cin >> c;
a.insert(-c);
}
set<int>::iterator it = a.begin();
for (int g = 0; g < 3; g++)
{
h -= *it;
*it++;
}
set<int> aa;
int h = 0;
for (int bb = 0; bb < 10; b++)
{
int cc;
cin >> cc;
a.insert(-cc);
}
set<int>::iterator itt = aa.begin();
for (int g = 0; g < 3; g++)
{
hh -= *itt;
*itt++;
}
cout << h << endl;
cout << hh << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:13: error: redeclaration of 'int h'
23 | int h = 0;
| ^
a.cc:8:13: note: 'int h' previously declared here
8 | int h = 0;
| ^
a.cc:24:35: error: 'b' was not declared in this scope; did you mean 'bb'?
24 | for (int bb = 0; bb < 10; b++)
| ^
| bb
|
s879958193 | p00456 | C++ | #include <iostream>
#include <set>
using namespace std;
int main()
{
set<int> a;
int h = 0;
int hh = 0;
for (int b = 0; b < 10; b++)
{
int c;
cin >> c;
a.insert(-c);
}
set<int>::iterator it = a.begin();
for (int g = 0; g < 3; g++)#include <iostream>
#include <set>
using namespace std;
int main()
{
set<int> a;
int h = 0;
int hh = 0;
for (int b = 0; b < 10; b++)
{
int c;
cin >> c;
a.insert(-c);
}
set<int>::iterator it = a.begin();
for (int g = 0; g < 3; g++)
{
h -= *it;
*it++;
}
set<int> aa;
int h = 0;
for (int bb = 0; bb < 10; bb++)
{
int cc;
cin >> cc;
a.insert(-cc);
}
set<int>::iterator itt = aa.begin();
for (int g = 0; g < 3; g++)
{
hh -= *itt;
*itt++;
}
cout << h << endl;
cout << hh << endl;
getchar();
getchar();
return 0;
}
{
h -= *it;
*it++;
}
set<int> aa;
int h = 0;
for (int bb = 0; bb < 10; b++)
{
int cc;
cin >> cc;
a.insert(-cc);
}
set<int>::iterator itt = aa.begin();
for (int g = 0; g < 3; g++)
{
hh -= *itt;
*itt++;
}
cout << h << endl;
cout << hh << endl;
return 0;
} | a.cc:17:36: error: stray '#' in program
17 | for (int g = 0; g < 3; g++)#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:17:37: error: 'include' was not declared in this scope
17 | for (int g = 0; g < 3; g++)#include <iostream>
| ^~~~~~~
a.cc:17:54: error: expected primary-expression before '>' token
17 | for (int g = 0; g < 3; g++)#include <iostream>
| ^
a.cc:19:1: error: expected primary-expression before 'using'
19 | using namespace std;
| ^~~~~
a.cc:21:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
21 | int main()
| ^~
a.cc:21:9: note: remove parentheses to default-initialize a variable
21 | int main()
| ^~
| --
a.cc:21:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:22:1: error: a function-definition is not allowed here before '{' token
22 | {
| ^
a.cc:63:13: error: redeclaration of 'int h'
63 | int h = 0;
| ^
a.cc:8:13: note: 'int h' previously declared here
8 | int h = 0;
| ^
a.cc:64:35: error: 'b' was not declared in this scope; did you mean 'bb'?
64 | for (int bb = 0; bb < 10; b++)
| ^
| bb
|
s206653745 | p00456 | C++ | #include <iostream>
#include <set>
using namespace std;
int main()
{
set<int> a;
int h = 0;
int hh = 0;
for (int b = 0; b < 10; b++)
{
int c;
cin >> c;
a.insert(-c);
}
set<int>::iterator it = a.begin();
for (int g = 0; g < 3; g++)
{
h -= *it;
*it++;
}
set<int> aa;
int h = 0;
for (int bb = 0; bb < 10; bb++)
{
int cc;
cin >> cc;
a.insert(-cc);
}
set<int>::iterator itt = aa.begin();
for (int g = 0; g < 3; g++)
{
hh -= *itt;
*itt++;
}
cout << h << endl;
cout << hh << endl;
getchar();
getchar();
return 0;
} | a.cc: In function 'int main()':
a.cc:23:13: error: redeclaration of 'int h'
23 | int h = 0;
| ^
a.cc:8:13: note: 'int h' previously declared here
8 | int h = 0;
| ^
|
s576258761 | p00456 | C++ | #include <iostream>
#include <set>
using namespace std;
int main()
{
set<int> a;
int h = 0;
int hh = 0;
for (int b = 0; b < 10; b++)
{
int c;
cin >> c;
a.insert(-c);
}
set<int>::iterator it = a.begin();
for (int g = 0; g < 3; g++)
{
h -= *it;
*it++;
}
set<int> aa;
int h = 0;
for (int bb = 0; bb < 10; bb++)
{
int cc;
cin >> cc;
a.insert(-cc);
}
set<int>::iterator itt = aa.begin();
for (int g = 0; g < 3; g++)
{
hh -= *itt;
*itt++;
}
cout << h << endl;
cout << hh << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:13: error: redeclaration of 'int h'
23 | int h = 0;
| ^
a.cc:8:13: note: 'int h' previously declared here
8 | int h = 0;
| ^
|
s461032577 | p00456 | C++ | #include <cstdio>
#include <iostream>
#include <array>
#include <algorithm>
using namespace std;
int main() {
array<array<int,10>,2> ar;
for(int i = 0; 2 > i; i++){
for(int j = 0; 10 > j; j++){
scanf("%d\n", &ar[i][j]);
}
sort(ar[i].begin(), ar[i].end(), [](int a, int b){return a > b;});
}
printf("%d %d\n", accumulate(ar[0].begin(), ar[0].begin()+3, 0), accumulate(ar[1].begin(), ar[1].begin()+3, 0));
return 0;
} | a.cc: In function 'int main()':
a.cc:15:27: error: 'accumulate' was not declared in this scope
15 | printf("%d %d\n", accumulate(ar[0].begin(), ar[0].begin()+3, 0), accumulate(ar[1].begin(), ar[1].begin()+3, 0));
| ^~~~~~~~~~
|
s821793414 | p00456 | C++ | #include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;
int main(void){
vector<int> a(10), b(10);
for(auto & e : a) cin >> e;
for(auto & e : b) cin >> e;
sort(begin(a), end(a), grater<int>());
sort(begin(b), end(b), grater<int>());
cout << a[0] + a[1] + a[2] << " " << b[0] + b[1] + b[2] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:28: error: 'grater' was not declared in this scope
10 | sort(begin(a), end(a), grater<int>());
| ^~~~~~
a.cc:10:35: error: expected primary-expression before 'int'
10 | sort(begin(a), end(a), grater<int>());
| ^~~
a.cc:11:35: error: expected primary-expression before 'int'
11 | sort(begin(b), end(b), grater<int>());
| ^~~
|
s224586912 | p00456 | C++ | #include<iostream>
using namespace std;
int x[10][2],sum[2],c,d;
int main(){
for(int i=0;i<20;i++){cin>>x[i%10][i/10];}
for(int i=9999;i>=0;i--){if(c>=3){break;}
for(int j=0;j<10;j++){if(x[j][0]==i){c++;sum[0]+=x[j][0]}}}
for(int i=9999;i>=0;i--){if(d>=3){break;}
for(int j=0;j<10;j++){if(x[j][1]==i){d++;sum[1]+=x[j][1]}}}
cout<<sum[0]<<' '<<sum[1]<<endl;} | a.cc: In function 'int main()':
a.cc:7:57: error: expected ';' before '}' token
7 | for(int j=0;j<10;j++){if(x[j][0]==i){c++;sum[0]+=x[j][0]}}}
| ^
| ;
a.cc:9:57: error: expected ';' before '}' token
9 | for(int j=0;j<10;j++){if(x[j][1]==i){d++;sum[1]+=x[j][1]}}}
| ^
| ;
|
s372600175 | p00456 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int a[10];
int b[10];
cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]>>a[7]>>a[8]>>a[9]>>a[10];
cin>>b[1]>>b[2]>>b[3]>>b[4]>>b[5]>>b[6]>>b[7]>>b[8]>>b[9]>>b[10];
sort(a,a+10);
sort(b,b+10);
int c=a[10]+a[9]+a[8];
int d=b[10]+b[9]+b[8];
cout<<max(c,d)<<endl;
return 0; | a.cc: In function 'int main()':
a.cc:20:18: error: expected '}' at end of input
20 | return 0;
| ^
a.cc:8:11: note: to match this '{'
8 | int main(){
| ^
|
s557935531 | p00456 | C++ | #include <algorithm>
using namespace std;
int main()
{
int w[10], k[10], ans1, ans2;
for (int i = 0; i < 10; i++){
scanf("%d", &w[i]);
}
for (int i = 0; i < 10; i++){
scanf("%d", &k[i]);
}
sort(w, w+10);
sort(k, k+10);
ans1 = w[9] + w[8] + w[7];
ans2 = k[9] + k[8] + k[7];
printf("%d %d\n", ans1, ans2);
return (0);
} | a.cc: In function 'int main()':
a.cc:9:17: error: 'scanf' was not declared in this scope
9 | scanf("%d", &w[i]);
| ^~~~~
a.cc:12:17: error: 'scanf' was not declared in this scope
12 | scanf("%d", &k[i]);
| ^~~~~
a.cc:22:9: error: 'printf' was not declared in this scope
22 | printf("%d %d\n", ans1, ans2);
| ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
1 | #include <algorithm>
+++ |+#include <cstdio>
2 | using namespace std;
|
s105841926 | p00456 | C++ | #include<cstdio>
#include<string>
#include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> a;
vector<int> b;
for(int i=0;i<10;i++){
int c;
cin>>c;
a.push_back(c);
}
for(int i=0;i<10;i++){
int c;
cin>>c;
b.push_back(c);
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
printf("%d %d\n", a[7]+a[8]+a[9], b[7]+b[8]+b[9]);
} | a.cc: In function 'int main()':
a.cc:26:9: error: 'sort' was not declared in this scope; did you mean 'short'?
26 | sort(a.begin(), a.end());
| ^~~~
| short
|
s755941803 | p00456 | C++ | #include <cstdio>
using namespace std;
int main()
{
int w[3],x;
for(int j=0;j<2;j++){
memset(w,0,sizeof(w));
for(int i=0;i<10;i++){
scanf("%d",&x);
if(x>w[0]){w[2]=w[1]; w[1]=w[0]; w[0]=x}
else if(x>w[1]) {w[2]=w[1]; w[1]=x;}
else if(x>w[2]) w[2]=x;
}
printf("%d\n",w[0]+w[1]+w[2]);
}
} | a.cc: In function 'int main()':
a.cc:7:2: error: 'memset' was not declared in this scope
7 | memset(w,0,sizeof(w));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <cstdio>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:10:41: error: expected ';' before '}' token
10 | if(x>w[0]){w[2]=w[1]; w[1]=w[0]; w[0]=x}
| ^
| ;
|
s725432131 | p00456 | C++ | #include <cstdio>
using namespace std;
int main()
{
int w[3],x;
for(int j=0;j<2;j++){
memset(w,0,sizeof(w));
for(int i=0;i<10;i++){
scanf("%d",&x);
if(x>w[0]){w[2]=w[1]; w[1]=w[0]; w[0]=x;}
else if(x>w[1]) {w[2]=w[1]; w[1]=x;}
else if(x>w[2]) w[2]=x;
}
printf("%d\n",w[0]+w[1]+w[2]);
}
} | a.cc: In function 'int main()':
a.cc:7:2: error: 'memset' was not declared in this scope
7 | memset(w,0,sizeof(w));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <cstdio>
+++ |+#include <cstring>
2 | using namespace std;
|
s949804964 | p00456 | C++ | #include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
int w[3],x;
for(int j=0;j<2;j++){
memset(w,0,sizeof(w));
for(int i=0;i<10;i++){
scanf("%d",&x);
if(x>w[0]){w[2]=w[1]; w[1]=w[0]; w[0]=x;}
else if(x>w[1]) {w[2]=w[1]; w[1]=x;}
else if(x>w[2]) w[2]=x;
}
printf("%d\n",w[0]+w[1]+w[2]);
}
} | a.cc: In function 'int main()':
a.cc:8:2: error: 'memset' was not declared in this scope
8 | memset(w,0,sizeof(w));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cstdlib>
+++ |+#include <cstring>
3 | using namespace std;
|
s043761417 | p00456 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
char h[3]={ ,\n};
int main()
{
int w[3],x;
for(int j=0;j<2;j++){
memset(w,0,sizeof(w));
for(int i=0;i<10;i++){
scanf("%d",&x);
if(x>w[0]){w[2]=w[1]; w[1]=w[0]; w[0]=x;}
else if(x>w[1]) {w[2]=w[1]; w[1]=x;}
else if(x>w[2]) w[2]=x;
}
printf("%d%c",w[0]+w[1]+w[2],h[j]);
}
} | a.cc:5:14: error: stray '\' in program
5 | char h[3]={ ,\n};
| ^
a.cc:5:13: error: expected primary-expression before ',' token
5 | char h[3]={ ,\n};
| ^
a.cc:5:15: error: 'n' was not declared in this scope
5 | char h[3]={ ,\n};
| ^
|
s767722427 | p00456 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> a(10);
vector<int> b(10);
for(int i=0;i<10;i++){
cin >> a[i];
}
for(int i=0;i<10;i++){
cin >> b[i];
}
vector<int> c=reverse(a.begin(),a.end());
vector<int> d=reverse(a.begin(),a.end());
sort(c.begin(),c.end());
cout << c[0] + c[1] + c[2] << " ";
sort(d.begin(),d.end());
cout << d[0] + d[1] + d[2] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:30: error: conversion from 'void' to non-scalar type 'std::vector<int>' requested
14 | vector<int> c=reverse(a.begin(),a.end());
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:15:30: error: conversion from 'void' to non-scalar type 'std::vector<int>' requested
15 | vector<int> d=reverse(a.begin(),a.end());
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
|
s806251133 | p00456 | C++ | 23
23
20
15
15
14
13
9
7
6
25
19
17
17
16
13
12
11
9
5 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 23
| ^~
|
s003438824 | p00456 | C++ | #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;
//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
for (int i = 0; i < 2; ++i) {
vector<int>v(10;)
for (int j = 0; j < 10; ++j) {
cin>>vs[j]
}
sort(vs.begin(), vs.end());
cout << vs[7] + vs[8] + vs[9] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:32: error: expected ')' before ';' token
14 | vector<int>v(10;)
| ~ ^
| )
a.cc:14:33: error: expected primary-expression before ')' token
14 | vector<int>v(10;)
| ^
a.cc:15:33: error: 'j' was not declared in this scope
15 | for (int j = 0; j < 10; ++j) {
| ^
a.cc:18:22: error: 'vs' was not declared in this scope; did you mean 'v'?
18 | sort(vs.begin(), vs.end());
| ^~
| v
|
s140440185 | p00456 | C++ | #include <cstdio>
#include <vector>
using namespace std;
int main(){
vector<int> w, k;
for (int i = 0; i < 10; i++){
int x;
scanf("%d", &x);
w.push_back(x);
}
for (int i = 0; i < 10; i++){
int x;
scanf("%d", &x);
k.push_back(x);
}
sort(w.begin(), w.end());
sort(k.begin(), k.end());
printf("%d %d\n", w[7] + w[8] + w[9], k[7] + k[8] + k[9]);
return 0;
} | a.cc: In function 'int main()':
a.cc:18:9: error: 'sort' was not declared in this scope; did you mean 'short'?
18 | sort(w.begin(), w.end());
| ^~~~
| short
|
s947238870 | p00456 | C++ | #include <stdio.h>
#define N 10
int main(void){
int wScores[N];
int kScores[N];
int wBests,kBests;
for (int i=0;i<N;i++) scanf("%d",&wScores[i]);
for (int i=0;i<N;i++) scanf("%d",&kScores[i]);
wBests=0; kBests=0;
for (int i=0;i<3;i++){
int max, p;
max = 0;
for (int j=0;j<N;j++){
if (wScores[j] > max){
max = wScores[j];
p = j;
}
}
wBests += max;
wScores[p] = 0;
}
for (int i=0;i<3;i++){
int max, p;
max = 0;
for (int j=0;j<N;j++){
if (wScores[j] > max){
max = wScores[j];
p = j;
}
}
wBests += max;
wScores[p] = 0;
}
for (int i=0;i<3;i++){
int max, p;
max = 0;
for (int j=0;j<N;j++){
if (wScores[j] > max){
max = kScores[j];
p = j;
}
}
kBests += max;
kScores[p] = 0;
}
printf("%d %d\n",wBests, kBests); | a.cc: In function 'int main()':
a.cc:50:42: error: expected '}' at end of input
50 | printf("%d %d\n",wBests, kBests);
| ^
a.cc:5:15: note: to match this '{'
5 | int main(void){
| ^
|
s165522552 | p00456 | C++ | #include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;
int main(){
int A = 0, B = 0;
int buf;
for (int a = 0; a < 10, a++){
scanf("%d", &buf);
A += buf;
}
for (int a = 0; a < 10, a++){
scanf("%d", &buf);
B += buf;
}
printf("%d %d\n", A, B);
return 0;
} | a.cc: In function 'int main()':
a.cc:9:36: error: expected ';' before ')' token
9 | for (int a = 0; a < 10, a++){
| ^
| ;
a.cc:13:36: error: expected ';' before ')' token
13 | for (int a = 0; a < 10, a++){
| ^
| ;
|
s654351141 | p00456 | C++ | #include<iostream>
#Include<algorithm>
using namespace std;
int a[10], b[10];
int main(){
for(int i = 0;i < 10;i++){
cin >> a[i];
}
sort(a, a + 10);
for(int i = 0;i < 10;i++){
cin >> b[i];
}
sort(b, b + 10);
cout << a[9] + a[8] + a[7] << " " << b[9] + b[8] + b[7] << endl;
return 0;
} | a.cc:2:2: error: invalid preprocessing directive #Include; did you mean #include?
2 | #Include<algorithm>
| ^~~~~~~
| include
a.cc: In function 'int main()':
a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'?
13 | sort(a, a + 10);
| ^~~~
| short
|
s881487280 | p00456 | C++ | #include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0;i < N;i++)
int main()
{
int data[10];
int sum[2];
Rep(p,2) {
Rep(i,10)cin >> data[i];
sort(data, data + 10,greater<int> );
sum[p] = accumulate(data, data + 3,0);
}
cout << sum[0] << " " << sum[1] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:39: error: expected primary-expression before ')' token
10 | sort(data, data + 10,greater<int> );
| ^
|
s990217922 | p00456 | C++ | a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
f = gets.to_i
g = gets.to_i
h = gets.to_i
i = gets.to_i
j = gets.to_i
k = gets.to_i
l = gets.to_i
m = gets.to_i
n = gets.to_i
o = gets.to_i
p = gets.to_i
q = gets.to_i
r = gets.to_i
s = gets.to_i
t = gets.to_i
print("#{a+b+c+d+e+f+g+h+i+j} ")
print("#{k+l+m+n+o+p+q+r+s+t}\n") | a.cc:1:1: error: 'a' does not name a type
1 | a = gets.to_i
| ^
|
s874570998 | p00456 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int P[2];
for(int i = 0; i < 2; i++){
vector<int> point(10);
for(int j = 0; j < 10; j++){
cin >> point[j];
}
sort(point.begin(), point.end());
point[0] + point[1] + point[2];
}
cout << p[0] << " " << P[1] << endl;
} | a.cc: In function 'int main()':
a.cc:16:11: error: 'p' was not declared in this scope
16 | cout << p[0] << " " << P[1] << endl;
| ^
|
s676599333 | p00456 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int P[2];
for(int i = 0; i < 2; i++){
vector<int> point(10);
for(int j = 0; j < 10; j++){
cin >> point[j];
}
sort(point.rbegin(), point.rend(), );
P[i] = point[0] + point[1] + point[2];
}
cout << P[0] << " " << P[1] << endl;
} | a.cc: In function 'int main()':
a.cc:13:40: error: expected primary-expression before ')' token
13 | sort(point.rbegin(), point.rend(), );
| ^
|
s293519448 | p00456 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> w(10);
vector<int> k(10);
int w1=0;
int w2=0;
int w3=0;
for(int i=0;i<10;++i)
cin>>w[i];
for(int i=0;i<10;++i)
cin>>k[i];
int temp;
for(int i=0;i<10;++i){
if(w1>w[i]){
w1=w[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(w2>w[i]){
w2=w[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(w3>w[i]){
w3=w[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(w1>k[i]){
w1=k[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(w2>k[i]){
w2=k[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(w3>k[i]){
w3=k[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(w1>k[i]){
w1=k[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(w2>k[i]){
w2=k[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(w3>k[i]){
w3=k[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(k1>k[i]){
k1=k[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(k2>k[i]){
k2=k[i];
temp=i;
}
}
for(int i=0;i<10;++i){
if(k3>k[i]){
k3=k[i];
temp=i;
}
}
cout<<w1+w2+w3<<" "<<k1+k2+k3<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:84:12: error: 'k1' was not declared in this scope; did you mean 'w1'?
84 | if(k1>k[i]){
| ^~
| w1
a.cc:91:12: error: 'k2' was not declared in this scope; did you mean 'w2'?
91 | if(k2>k[i]){
| ^~
| w2
a.cc:98:12: error: 'k3' was not declared in this scope; did you mean 'w3'?
98 | if(k3>k[i]){
| ^~
| w3
a.cc:104:24: error: 'k1' was not declared in this scope; did you mean 'w1'?
104 | cout<<w1+w2+w3<<" "<<k1+k2+k3<<endl;
| ^~
| w1
a.cc:104:27: error: 'k2' was not declared in this scope; did you mean 'w2'?
104 | cout<<w1+w2+w3<<" "<<k1+k2+k3<<endl;
| ^~
| w2
a.cc:104:30: error: 'k3' was not declared in this scope; did you mean 'w3'?
104 | cout<<w1+w2+w3<<" "<<k1+k2+k3<<endl;
| ^~
| w3
|
s040048515 | p00456 | C++ | using namespace std;
int main(){
int p[10];
for(int i=0;i<2;i++){
for(int j=0;j<10;j++)cin>>p[j];
sort(p,p+10);
if(i)cout<<" ";
cout<<p[7]+p[8]+p[9];
}
cout<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:5:38: error: 'cin' was not declared in this scope
5 | for(int j=0;j<10;j++)cin>>p[j];
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:6:17: error: 'sort' was not declared in this scope; did you mean 'short'?
6 | sort(p,p+10);
| ^~~~
| short
a.cc:7:22: error: 'cout' was not declared in this scope
7 | if(i)cout<<" ";
| ^~~~
a.cc:7:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:17: error: 'cout' was not declared in this scope
8 | cout<<p[7]+p[8]+p[9];
| ^~~~
a.cc:8:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:9: error: 'cout' was not declared in this scope
10 | cout<<endl;
| ^~~~
a.cc:10:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:15: error: 'endl' was not declared in this scope
10 | cout<<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using namespace std;
|
s315391888 | p00456 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main()
{
int a;
// int w[10] = {0};
// int k[10] = {0};
vector<int> w(10);
vector<int> k(10);
for(int i = 0; i < 10; i++){
cin >> w[i];
}
for(int i = 0; i < 10; i++){
cin >> k[i];
}
sort(w.begin(), w.end());
sort(k.begin(), k.end());
printf("%d %d",w[9]+w[8]+w[7],k[9]+k[8]+k[7] );
return 0;
}
| a.cc: In function 'int main()':
a.cc:23:9: error: 'sort' was not declared in this scope; did you mean 'short'?
23 | sort(w.begin(), w.end());
| ^~~~
| short
|
s242696000 | p00456 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int a;
vector<int> vc;
for(int i=0 ; i<10 ; ++i ){
cin >> a;
vc.push_back( a );
}
sort( vc.begin() , vc.end() );
cout << vc[9]+vc[8]+vc[7] << " ";
vc.clear();
for(int i=0 ; i<10 ; ++i ){
cin >> a;
vc.push_back( a );
}
sort( vc.begin() , vc.end() );
cout << vc[9]+vc[8]+vc[7] << endl;
} | a.cc: In function 'int main()':
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort( vc.begin() , vc.end() );
| ^~~~
| short
|
s987731756 | p00456 | C++ | #include <stdio.h>
#include <stdlib.h>
int d0,d1,d2,d3,dmax,x,y;
int board[92][92];
int Search(x,y){
if(board[x][y]==0) return 0;
board[x][y]=0;
d0=Search((x-1),y);
dmax=d0;
d1=Search((x+1),y);
if(dmax<d1) dmax=d1;
d2=Search(x,(y-1));
if(dmax<d2) dmax=d2;
d3=Search(x,(y+1));
if(dmax<d3) dmax=d3;
board[x][y]=1;
return dmax+1;
}
int main(void) {
int max=0,m,n,i,j;
scanf("%d\n%d",&m,&n);
for (i=1;i<=m;i++){
for(j=1;j<=n;j++){
scanf("%d",&board[i][j]);
}
}
for (i=1;i<=m;i++){
for(j=1;j<=n;j++){
int r=Search(i,j);
if (max<r) max=r;
}
}
printf("%d\n",max);
return EXIT_SUCCESS;
} | a.cc:8:15: error: expression list treated as compound expression in initializer [-fpermissive]
8 | int Search(x,y){
| ^
a.cc:8:16: error: expected ',' or ';' before '{' token
8 | int Search(x,y){
| ^
a.cc: In function 'int main()':
a.cc:41:41: error: 'Search' cannot be used as a function
41 | int r=Search(i,j);
| ~~~~~~^~~~~
|
s486797231 | p00456 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
vector<int> w(10);
vector<int> k(10);
for(int i=0; i<10; i++){
cin >> w[i];
}
for(int i=0; i<10; i++){
cin >> k[i];
}
sort(w.begin(), w.end(), greater<int>());
sort(k.begin(), k.end(), greater<int>());
int w_sum = 0;
int k_sum = 0;
for(int i=0; i<3; i++){
w_sum += w[i];
k_sum += k[i];
}
printf("%d %d\n", w_sum, k_sum);
return 0;
} | a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
17 | sort(w.begin(), w.end(), greater<int>());
| ^~~~
| short
|
s581512662 | p00456 | C++ | #include <cstdi>
#include <cstdlib>
using namespace std;
int main() {
int w[10],k[10];
int i,j,p,q,t,s;
int wsum=0,ksum=0,swap;
for(i=0;i<10;i++) {
scanf("%d\n",&w[i]);
}
for(t=0;t<10;t++){
for(j=0;j<10;j++){
if (w[j]>w[j+1]) {
swap=w[j];
w[j]=w[j+1];
w[j+1]=swap;
}
}
}
wsum=w[9]+w[8]+w[7];
for(p=0;p<10;p++){
scanf("%d\n",&k[p]);
}
for(s=0;s<10;s++){
for(q=0;q<10;q++){
if (k[q]>k[q+1]) {
swap=k[q];
k[q]=k[q+1];
k[q+1]=swap;
}
}
}
ksum=k[9]+k[8]+k[7];
printf("%d %d\n",wsum,ksum);
return 0;
} | a.cc:1:10: fatal error: cstdi: No such file or directory
1 | #include <cstdi>
| ^~~~~~~
compilation terminated.
|
s538238663 | p00456 | C++ | #include <vector>
#include <iostream>
using namespace std;
int main(){
vector<int> w, k;
int b;
for (int i = 0; i < 10; i++){
cin >> b;
w.push_back(b);
}
for (int i = 0; i < 10; i++){
cin >> b;
k.push_back(b);
}
sort(w.begin(), w.end(), greater<int>());
sort(k.begin(), k.end(), greater<int>());
int ww = 0, kk = 0;
for (int i = 0; i < 3; i++) ww += w[i];
for (int i = 0; i < 3; i++) kk += k[i];
cout << ww << " " << kk << endl;
} | a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
17 | sort(w.begin(), w.end(), greater<int>());
| ^~~~
| short
|
s099285208 | p00456 | C++ | #include<iostream>
using namespace std;
int main(void){
int ans1=0,ans2=0,a[10],b[10];
for(int i=0;i<10;i++) cin>> a[i];
for(int i=0;i<10;i++) cin >> b[i];
sort(a,a+10);
sort(b,b+10);
for(int i=7;i<=9;i++){
ans1 +=a[i];
ans2 +=b[i];
}cout << ans1<< " " << ans2<< endl;
} | a.cc: In function 'int main()':
a.cc:7:3: error: 'sort' was not declared in this scope; did you mean 'short'?
7 | sort(a,a+10);
| ^~~~
| short
|
s921865191 | p00456 | C++ | #include <stdio.h>
int main(){
int a=0,b=0,c=0,s;
int i,j;
for(i=0,i<10,i++){
scanf("%d \n",&s);
if(s>a){
c=b;
b=a;
a=s;
}
else if(s>b){
c=b;
b=s;
}
else if(s>c){
c = s;
}
}
printf("%d ",a+b+c);
a=0; b=0; c=0;
for(i=0,i<10,i++){
scanf("%d \n",&s);
if(s>a){
c=b;
b=a;
a=s;
}
else if(s>b){
c=b;
b=s;
}
else if(s>c){
c = s;
}
}
printf("%d\n",a+b+c);
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:25: error: expected ';' before ')' token
6 | for(i=0,i<10,i++){
| ^
| ;
a.cc:22:12: error: expected ')' before ';' token
22 | a=0; b=0; c=0;
| ^
| )
a.cc:6:12: note: to match this '('
6 | for(i=0,i<10,i++){
| ^
a.cc:23:25: error: expected ';' before ')' token
23 | for(i=0,i<10,i++){
| ^
| ;
a.cc:39:9: error: expected primary-expression before 'return'
39 | return 0;
| ^~~~~~
a.cc:38:30: error: expected ')' before 'return'
38 | printf("%d\n",a+b+c);
| ^
| )
39 | return 0;
| ~~~~~~
a.cc:23:12: note: to match this '('
23 | for(i=0,i<10,i++){
| ^
|
s739489902 | p00456 | C++ | #include <stdio.h>
void swap(int *a,int *b){
int tmp;
tmp = *a;
*a=*b;
*b=tmp;
return;
}
int main(){
int i,n,k[10],w[10],K,W;
K=W=0;
for(i=0;i<10;i++){
scanf("%d",&n);
w[i]=n;
}
for(i=0;i<10;i++){
scanf("%d",&n);
k[i]=n;
}
for(i=0;i<3;i++){
for(int j=i+1;j<10;j++) if(k[i]<k[j]) swap(&k[i],k[j]);
}
for(i=0;i<3;i++){
for(int j=i+1;j<10;j++) if(w[i]<w[j]) swap(&w[i],w[j]);
}
for(i=0;i<3;i++){
K+=k[i];W+=w[i];
}
printf("%d %d\n",W,K);
return 0;
} | a.cc: In function 'int main()':
a.cc:21:57: error: invalid conversion from 'int' to 'int*' [-fpermissive]
21 | for(int j=i+1;j<10;j++) if(k[i]<k[j]) swap(&k[i],k[j]);
| ~~~^
| |
| int
a.cc:2:23: note: initializing argument 2 of 'void swap(int*, int*)'
2 | void swap(int *a,int *b){
| ~~~~~^
a.cc:24:57: error: invalid conversion from 'int' to 'int*' [-fpermissive]
24 | for(int j=i+1;j<10;j++) if(w[i]<w[j]) swap(&w[i],w[j]);
| ~~~^
| |
| int
a.cc:2:23: note: initializing argument 2 of 'void swap(int*, int*)'
2 | void swap(int *a,int *b){
| ~~~~~^
|
s524608197 | p00456 | C++ | #include <iostream>
using namespace std;
int main(){
int sum[2] = {0};
for(int i = 0; i < 2; i++){
int x[10];
for(int j = 0; j < 10; j++){
cin >> x[j];
}
sort(x, x + 10);
sum[i] += x[9] + x[8] + x[7];
}
cout << sum[0] << " " << sum[1] << endl;
} | a.cc: In function 'int main()':
a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(x, x + 10);
| ^~~~
| short
|
s310040713 | p00457 | C | #include <stdio.h>
int chain(int chara[],int i,int j,int n){
int count1,count2,c,k,m;
count1 = count2 = 0;
chara[i] = j;
for(c = i;chara[i] == chara[i+1] && i < n-1 ;c++){
count1++;
}
for(c = i;chara[i] == chara[i-1] && i > 0 ;c--){
count2++;
}
if(count1 + count2 < 3) return 0;
else {
for(c = i - count2;c <= i + count1;c++){
chara[c] = 0;
}
}
m = count1 + count2
while(1){
for(c = i+ count1+1;c < n ;c++ ){
if(chara[c] == chara[c+1]) count1++;
else {
count1++;c = n;k = chara[c]
}
}
}
for(c = i-count2-1;c > 0 ;c-- ){
if(chara[c] == chara[c-1] && chara[c-1] == k ) count2++;
else {
count2++;c = 0;
}
}
}
if(count1 + count2 < 2) break;
m = m + count1 + count2;
}
return n-m ;
}
int main(){
int n,t,i,chara[10000],Min,temp;
while(1){
scanf("%d",&n);
if(n == 0) break;
for(i=0;i<n;i++){
scanf("%d",&chara[i]);
}
for(i=0;i<n;i++){
if(chara[i] == 1){
temp = chain(chara,i,2,n);
if(temp > chain(chara,i,3,n)) temp = chain(chara,i,3,n);
if(Min > temp) Min = temp;
}
if(chara[i] == 2){
temp = chain(chara,i,1,n);
if(temp > chain(chara,i,3,n)) temp = chain(chara,i,3,n);
if(Min > temp) Min = temp;
}
if(chara[i] == 3){
temp = chain(chara,i,1,n);
if(temp > chain(chara,i,2,n)) temp = chain(chara,i,2,n);
if(Min > temp) Min = temp;
}
}
printf("%d",Min);
}
return 0;
} | main.c: In function 'chain':
main.c:19:22: error: expected ';' before 'while'
19 | m = count1 + count2
| ^
| ;
20 |
21 | while(1){
| ~~~~~
main.c: At top level:
main.c:36:5: error: expected identifier or '(' before 'if'
36 | if(count1 + count2 < 2) break;
| ^~
main.c:37:5: warning: data definition has no type or storage class
37 | m = m + count1 + count2;
| ^
main.c:37:5: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
main.c:37:13: error: 'count1' undeclared here (not in a function)
37 | m = m + count1 + count2;
| ^~~~~~
main.c:37:22: error: 'count2' undeclared here (not in a function)
37 | m = m + count1 + count2;
| ^~~~~~
main.c:38:3: error: expected identifier or '(' before '}' token
38 | }
| ^
main.c:40:3: error: expected identifier or '(' before 'return'
40 | return n-m ;
| ^~~~~~
main.c:41:1: error: expected identifier or '(' before '}' token
41 | }
| ^
|
s514047752 | p00457 | C++ | Unacceptable submission | a.cc:1:1: error: 'Unacceptable' does not name a type
1 | Unacceptable submission
| ^~~~~~~~~~~~
|
s854407190 | p00457 | C++ | #include <cstdio>
#include <algorithm>
#define INF (500000)
using namespace std;
int array[20000];
int main()
{
int N;
while (scanf("%d", &N), N){
memset(array, 0, sizeof(array));
for (int i = 1; i <= N; i++){
scanf("%d", &array[i]);
}
int mini = INF;
for (int i = 1; i <= N; i++){
for (int j = 0; j < 2; j++){
array[i] = array[i] % 3 + 1;
int u = i;
int d = i;
int color = array[i];
int cnt = 4;
int sum = 0;
while (cnt >= 4) {
if (sum == 0){
cnt = 1;
}
else {
cnt = 0;
}
if (array[d + 1] == 0){
break;
}
color = array[d + 1];
while (array[u - 1] == color){
u--;
cnt++;
}
while (array[d + 1] == color){
d++;
cnt++;
}
if (cnt >= 4){
sum += cnt;
}
else {
break;
}
}
mini = min(mini, N - sum);
}
array[i] = array[i] % 3 + 1;
}
printf("%d\n", mini);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:24: error: reference to 'array' is ambiguous
12 | memset(array, 0, sizeof(array));
| ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:12:41: error: reference to 'array' is ambiguous
12 | memset(array, 0, sizeof(array));
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:12:17: error: 'memset' was not declared in this scope
12 | memset(array, 0, sizeof(array));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 | #define INF (500000)
a.cc:15:38: error: reference to 'array' is ambiguous
15 | scanf("%d", &array[i]);
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:22:33: error: reference to 'array' is ambiguous
22 | array[i] = array[i] % 3 + 1;
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:22:44: error: reference to 'array' is ambiguous
22 | array[i] = array[i] % 3 + 1;
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:26:45: error: reference to 'array' is ambiguous
26 | int color = array[i];
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:38:45: error: reference to 'array' is ambiguous
38 | if (array[d + 1] == 0){
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:42:49: error: reference to 'array' is ambiguous
42 | color = array[d + 1];
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:44:48: error: reference to 'array' is ambiguous
44 | while (array[u - 1] == color){
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:48:48: error: reference to 'array' is ambiguous
48 | while (array[d + 1] == color){
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:64:25: error: reference to 'array' is ambiguous
64 | array[i] = array[i] % 3 + 1;
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
a.cc:64:36: error: reference to 'array' is ambiguous
64 | array[i] = array[i] % 3 + 1;
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:6:5: note: 'int array [20000]'
6 | int array[20000];
| ^~~~~
|
s481017836 | p00457 | C++ | include<iostream>
#include<vector>
using namespace std;
struct block{
int color, many;
};
int main()
{
while(true){
int n;
cin >> n;
if(!n) break;
vector<block> line;
vector<block>::iterator p;
int max = 0;
for(int i = 0; i < n; i++){
int in;
cin >> in;
p = line.end() - 1;
if(!line.empty() && p->color == in){
p->many++;
}
else{
block newblock = {in, 1};
line.push_back(newblock);
}
}
//chain
vector<block>::iterator pp, pm;
for(p = line.begin() + 1; p != line.end() - 1; p++){
if(p->many == 1 && (p - 1)->color == (p + 1)->color && (p - 1)->many + (p + 1)->many >= 3){
int chain = (p - 1)->many + (p + 1)->many + 1;
pm = p - 1;
pp = p + 1;
while(true){
pm--;
pp++;
if(pm != line.begin() - 1 && pp != line.end() && pp->color ==pm->color && pp->many + pm->many >= 4){
chain += pp->many + pm->many;
}
else{
max = (max < chain) ? chain : max;
break;
}
}
}
}
cout << n - max << endl;
}
return 0;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| |
s394720541 | p00457 | C++ | #include <cstdio>
#include <vector>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int main()
{
while (true)
{
int N, A; unsigned MAX = 15000;
vector<int> D;
scanf("%d", &N);
for (int i = 0; i < N; i++)
{
scanf("%d", &A);
D.push_back(A);
}
for (int i = 0; i < N; i++)
{
for (int j = 1; j <= 3; j++)
{
if (D[i] != j)
{
vector<int> E(D.begin(), D.end());
E[i] = j;
for (int k = 0; k < E.size() - 3; k++)
{
loop:;
if (E.size() <= 3)
{
break;
}
if (E[k] == E[k + 1] && E[k + 1] == E[k + 2] && E[k + 2] == E[k + 3])
{
for (int l = 0; l < 3; l++)
{
E.erase(E.begin() + k);
}
while (k < E.size() - 1)
{
if (E[k] == E[k + 1])
{
E.erase(E.begin() + k);
}
else
{
break;
}
}
if (k < E.size())
{
E.erase(E.begin() + k);
}
k = 0;
goto loop;
}
}
MAX = min(E.size(), MAX);
}
}
}
printf("%d\n", MAX);
}
return 0;
}
// Time : O( 3n ^ 3 ) | a.cc: In function 'int main()':
a.cc:76:50: error: no matching function for call to 'min(std::vector<int>::size_type, unsigned int&)'
76 | MAX = min(E.size(), MAX);
| ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:76:50: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int')
76 | MAX = min(E.size(), MAX);
| ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:76:50: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
76 | MAX = min(E.size(), MAX);
| ~~~^~~~~~~~~~~~~~~
|
s473124715 | p00457 | C++ | #include <cstdio>
#include <vector>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int main()
{
while (true)
{
int N, A; unsigned MAX = 15000;
vector<int> D;
scanf("%d", &N);
for (int i = 0; i < N; i++)
{
scanf("%d", &A);
D.push_back(A);
}
for (int i = 0; i < N; i++)
{
for (int j = 1; j <= 3; j++)
{
if (D[i] != j)
{
vector<int> E(D.begin(), D.end());
E[i] = j;
for (int k = 0; k < E.size() - 3; k++)
{
loop:;
if (E.size() <= 3)
{
break;
}
if (E[k] == E[k + 1] && E[k + 1] == E[k + 2] && E[k + 2] == E[k + 3])
{
for (int l = 0; l < 3; l++)
{
E.erase(E.begin() + k);
}
while (k < E.size() - 1)
{
if (E[k] == E[k + 1])
{
E.erase(E.begin() + k);
}
else
{
break;
}
}
if (k < E.size())
{
E.erase(E.begin() + k);
}
k = 0;
goto loop;
}
}
MAX = min(E.size(), MAX);
}
}
}
printf("%d\n", MAX);
}
return 0;
}
// Time : O( 3n ^ 3 ) | a.cc: In function 'int main()':
a.cc:76:50: error: no matching function for call to 'min(std::vector<int>::size_type, unsigned int&)'
76 | MAX = min(E.size(), MAX);
| ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:76:50: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int')
76 | MAX = min(E.size(), MAX);
| ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:76:50: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
76 | MAX = min(E.size(), MAX);
| ~~~^~~~~~~~~~~~~~~
|
s294794195 | p00457 | C++ | #include<cstdio>
#include<algorithm>
main(){
while(true){
int x[15000],n,i,j,k,l,m,y[15000],b,c,d,p[15000],minx;
scanf("%d", &n);
if(n==0){break;}
for(i=0;i<n;i++){scanf("%d", &y[i]);p[i] = x[i] = y[i];}
c=0;d=0;m=n;d=m;
minx=99999;
for(i=0;i<n;i++){
for(j=1;j<=3;j++){
if(i>=1 && (y[i-1]!=j && y[i+1]!=j)){goto z;}
p[i] = x[i] = j;
b=1;d=n;
while(true){c=0;
for(k=0;k<m;k++){
if(p[k]==p[k+1]){b++;}
else{
if(b >= 4){
for(l = k + 1; l < m; l++){p[l-b] = p[l];}
d -= b;c++;
for(l=d;l<m;l++){p[l]=0;}
}
b=1;}
m=d;}
if(c==0){break;}
else{c=0;}
}
minx=min(minx,m);x[i]=y[i];
for(int k=0;k<n;k++){p[k]=y[k];}
z:;
}
}
printf("%d\n", minx);}
} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:30:6: error: 'min' was not declared in this scope; did you mean 'std::min'?
30 | minx=min(minx,m);x[i]=y[i];
| ^~~
| std::min
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s219775154 | p00457 | C++ | #include<cstdio>
#include<algorithm>
main(){
while(true){
int x[11000],n,i,j,k,l,m,y[11000],b,c,d,p[11000],minx;
scanf("%d", &n);
if(n==0){break;}
for(i=0;i<n;i++){scanf("%d", &y[i]);p[i]=x[i]=y[i];}
c=0;d=0;m=n;d=m;
minx=99999;
for(i=0;i<n;i++){
for(j=1;j<=3;j++){
if(i>=1&&y[i-1]!=j&&y[i+1]!=j)){goto z;}
p[i]=x[i]=j;b=1;d=n;
while(true){c=0;
for(k=0;k<m;k++){
if(p[k]==p[k+1]){b++;}
else{
if(b >= 4){
for(l=k+1;l<m;l++){p[l-b]=p[l];}
d -= b;c++;
for(l=d;l<m;l++){p[l]=0;}
}
b=1;}
m=d;}
if(c==0){break;}
else{c=0;}
}
minx=std::min(minx,m);x[i]=y[i];
for(int k=0;k<n;k++){p[k]=y[k];}
z:;
}
}
printf("%d\n",minx);}
} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:13:31: error: expected primary-expression before ')' token
13 | if(i>=1&&y[i-1]!=j&&y[i+1]!=j)){goto z;}
| ^
|
s883056371 | p00457 | C++ | #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;
//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int getans(vector<int>&l, vector<int>&r) {
int lt = l.back();
int rt = r[0];
int a = l.size() - 1;
while (a >= 0) {
if (lt == l[a]) {
a--;
}
else {
break;
}
}
int b = 0;
while (b <= r.size() - 1) {
if (rt == r[b]) {
b++;
}
else {
break;
}
}
if (lt == rt) {
int num = (l.size() - 1) - a + b;
if (num>=3) {
return num+1 + getans(vector<int>(l.begin(), l.begin() + a+1), vector<int>(r.begin() + b, r.end()));
}
else {
return 0;
}
}
}
int getans(vector<int>&as, int a) {
int f = a;
int t = a;
int color = as[a];
while (f >= 0) {
if (color == as[f])f--;
else break;
}
f++;
while (t <= as.size() - 1) {
if (color == as[t])t++;
else break;
}
t--;
if (t - f >= 3) {
return (t-f+1)+getans(vector<int>(as.begin(), as.begin() + f), vector<int>(as.begin() + t+1, as.end()));
}
}
int main() {
while (1) {
int N; cin >> N;
if (!N)break;
vector<int>as(N);
for (int i = 0; i < N; ++i) {
cin >> as[i];
as[i]--;
}
int ans = 0;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < 3; ++j) {
int a = as[i];
as[i] = j;
ans = max(ans, getans(as, i));
as[i] = a;
}
}
cout << N - ans << endl;
}
return 0;
} | a.cc: In function 'int getans(std::vector<int>&, std::vector<int>&)':
a.cc:38:47: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
38 | return num+1 + getans(vector<int>(l.begin(), l.begin() + a+1), vector<int>(r.begin() + b, r.end()));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:24: note: initializing argument 1 of 'int getans(std::vector<int>&, std::vector<int>&)'
14 | int getans(vector<int>&l, vector<int>&r) {
| ~~~~~~~~~~~~^
a.cc: In function 'int getans(std::vector<int>&, int)':
a.cc:60:39: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
60 | return (t-f+1)+getans(vector<int>(as.begin(), as.begin() + f), vector<int>(as.begin() + t+1, as.end()));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:24: note: initializing argument 1 of 'int getans(std::vector<int>&, std::vector<int>&)'
14 | int getans(vector<int>&l, vector<int>&r) {
| ~~~~~~~~~~~~^
|
s809815618 | p00457 | C++ | #include<cstdio>
#include<algorithm>
using namespace std;
char chain[10000];
int ccount(int a, int b, int cnt){
if (chain[a] != chain[b])return cnt;
int len = 0;
int i, j;
for (i = a; chain[a] == chain[i]; i--, len++);
for (j = b; chain[b] == chain[j]; j++, len++);
if (len < 4)return cnt;
return ccount(i, j, cnt + len);
}
int main(){
int n, ma = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &chain[i]);
for (int i = 0; i < n; i++){
char default = chain[i];
for (int j = 1; j <= 3; j++){
chain[i] = j;
int s, g, cnt = 1;
for (s = i - 1; chain[s] == chain[i]; s--, cnt++);
for (g = i + 1; chain[g] == chain[i]; g++, cnt++);
if (cnt >= 4){ ma = max(ccount(s, g, cnt), ma); }
}
chain[i] = default;
}
printf("%d\n", n - ma);
return 0;
} | a.cc: In function 'int main()':
a.cc:23:22: error: expected unqualified-id before 'default'
23 | char default = chain[i];
| ^~~~~~~
a.cc:31:28: error: expected primary-expression before 'default'
31 | chain[i] = default;
| ^~~~~~~
|
s720137342 | p00457 | C++ | #include<cstdio>
#include<algorithm>
using namespace std;
int n;
char chain[10000];
int ccount(int a, int b, int cnt){
if (chain[a] != chain[b])return cnt;
int len = 0;
int i, j;
for (i = a; chain[a] == chain[i]; i--, len++);
for (j = b; chain[b] == chain[j]; j++, len++);
if (len < 4)return cnt;
return ccount(i, j, cnt + len);
}
int main(){
while (scanf("%d", &n), n){
memset(chain, 0, sizeof(chain));
int ans = 0;
for (int i = 0; i < n; i++)
scanf("%d", &chain[i]);
for (int i = 0; i < n; i++){
char def = chain[i];
for (int j = 1; j <= 3; j++){
chain[i] = j;
int s, g, cnt = 1;
for (s = i - 1; chain[s] == chain[i]; s--, cnt++);
for (g = i + 1; chain[g] == chain[i]; g++, cnt++);
if (cnt >= 4){ ans = max(ccount(s, g, cnt), ans); }
}
chain[i] = def;
}
printf("%d\n", n - ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:17: error: 'memset' was not declared in this scope
20 | memset(chain, 0, sizeof(chain));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<algorithm>
+++ |+#include <cstring>
3 | using namespace std;
|
s975974315 | p00457 | C++ | #include <stdio.h>
#include <algorithm>
#define INF 123456789
int N, A[11234];
int memo_A[11234];
int bound[11234][3][2];
int ans = INF;
int how_same(int num, int color) {
int s1 = 0, s2 = 0;
for (int i = num + 1; i < N; ++i) {
if (A[i] == color) { ++s1; }
else if (A[i] != -1) {
bound[num][color][0] = i - 1;
break;
}
}
for (int i = num - 1; i >= 0; --i) {
if (A[i] == color) { ++s2; }
else if (A[i] != -1) {
bound[num][color][1] = i + 1;
break;
}
}
return s1 + s2 + 1;
}
int solve(int num, int color) {
int res = 0;
res += how_same(num, color);
if (res >= 4) {
for (int i = bound[num][color][1]; i <= bound[num][color][0]; ++i) { A[i] = -1; }
if (A[bound[num][color][1] - 1] == A[bound[num][color][0] + 1]) {
res += solve(bound[num][color][0] + 1, A[bound[num][color][0] + 1]);
}
else {
int tmp = 0;
tmp += how_same(bound[num][color][0] + 1, A[bound[num][color][0] + 1]);
if (tmp < 4) { tmp = 0; }
tmp += how_same(bound[num][color][1] - 1, A[bound[num][color][1] - 1]);
if (tmp < 4) { tmp = 0; }
}
}
if (res < 4) { res = 0; }
return res;
}
int main(void) {
while (true) {
scanf("%d", &N);
if (N == 0) { break; }
memset(bound, 0, sizeof(bound));
ans = INF;
for (int i = 0; i < N; ++i) { scanf("%d", &A[i]); }
for (int i = 0; i < N; ++i) { memo_A[i] = A[i]; }
for (int i = 1; i < N - 1; ++i) {
for (int j = 1; j <= 3; ++j) {
ans = std::min(ans, N - solve(i, j));
// printf("%d", ans);
// printf("(%d,%d)\n", i + 1, j);
for (int k = 0; k < N; ++k) {
// printf("%d", A[k]);
A[k] = memo_A[k];
}
// printf("\n----------\n");
}
}
printf("%d\n", ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:53:17: error: 'memset' was not declared in this scope
53 | memset(bound, 0, sizeof(bound));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 | #define INF 123456789
|
s957952448 | p00457 | C++ | #include<stdio.h>
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;
int p[10000]={0},o[10000]={0};
int X(int x){
int e,z,u,t=0,k,g=0,w;
for(e=0;e<x;e++){
u=0;
w=0;
if(o[e]!=0){
for(z=e;z<x;z++){
if(o[e]==o[z])u++;
else if(o[z]==0)w++;
else break;
}
if(u>=4){
t=1;
for(k=0;k<w+u;k++)o[e+k]=0;
}
if(o[e]!=0)g++;
}
if(t==1)return X(x);
return g;
}
int main(){
//int a[1000],b=0;
while(1){
int n,i,j,m=10001,l;
cin>>n;
if(n==0)break;
memset(p,0,sizeof(p));
memset(o,0,sizeof(o));
for(i=0;i<n;i++)cin>>p[i];
m=n;
for(i=0;i<n;i++){
for(j=1;j<=3;j++){
for(l=0;l<n;l++)o[l]=p[l];
o[i]=j;
m=min(m,X(n));
}
}
/*a[b]=m;
b++;*/
cout<<m<<endl;
}
//for(int r=0;r<b;r++)cout<<a[r]<<endl;
return 0;
}
| a.cc: In function 'int X(int)':
a.cc:28:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
28 | int main(){
| ^~
a.cc:28:9: note: remove parentheses to default-initialize a variable
28 | int main(){
| ^~
| --
a.cc:28:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:28:11: error: a function-definition is not allowed here before '{' token
28 | int main(){
| ^
a.cc:51:2: error: expected '}' at end of input
51 | }
| ^
a.cc:8:13: note: to match this '{'
8 | int X(int x){
| ^
a.cc:51:2: warning: control reaches end of non-void function [-Wreturn-type]
51 | }
| ^
|
s424842869 | p00457 | C++ | #include<stdio.h>
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;
int p[10000]={0},f[10000]={0},o[10000]={0};
/*int X(int x){
int e,z,u,t=0,k,g=0,w;
for(e=0;e<x;e++){
u=0;
w=0;
if(o[e]!=0){
for(z=e;z<x;z++){
if(o[e]==o[z])u++;
else if(o[z]==0)w++;
else break;
}
}
if(u>=4){
t=1;
for(k=0;k<w+u;k++)o[e+k]=0;
}
if(o[e]!=0)g++;
}
if(t==1)return X(x);
return g;
}*/
int main(){
//int a[1000],b=0;
while(1){
int n,i,j,m,l;
cin>>n;
if(n==0)break;
for(i=0;i<n;i++)cin>>p[i];
for(i=0;i<n;i++){
if(p[i]==p[i-1]&&i!=0)f[i]=f[i-1];
else{
for(j=i;j<n;j++){
if(p[i]==p[j])f[i]++;
else break;
}
}
}
m=n;
for(i=0;i<n;i++){
if(i!=n-1&&p[i]!=p[i+1]&&f[i]+f[i+1]>=4||i!=0&&p[i]!=p[i-1]&&f[i]+f[i-1]>=4){
for(j=1;j<=3;j++){
for(l=0;l<n;l++)o[l]=p[l];
if(o[i]!=j){
o[i]=j;
t=1;
while(t!=0){
int e,z,u,k,g=0,w;
t=0;
for(e=0;e<x;e++){
u=0;
w=0;
if(o[e]!=0){
for(z=e;z<x;z++){
if(o[e]==o[z])u++;
else if(o[z]==0)w++;
else break;
}
}
if(u>=4){
t=1;
for(k=0;k<w+u;k++)o[e+k]=0;
}
if(o[e]!=0)g++;
}
}
m=min(m,g);
}
}
}
}
/*a[b]=m;
b++;*/
cout<<m<<endl;
}
//for(int r=0;r<b;r++)cout<<a[r]<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:52:1: error: 't' was not declared in this scope
52 | t=1;
| ^
a.cc:56:11: error: 'x' was not declared in this scope
56 | for(e=0;e<x;e++){
| ^
a.cc:73:49: error: 'g' was not declared in this scope
73 | m=min(m,g);
| ^
|
s333409373 | p00457 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
#define col first
#define cn second
typedef pair<int, int> PR;
pair<int, int> puyo[10000+10] , tmp;
int sum;
int chek(int , /*PR[10000 + 10],*/ int ,int,int);
int main()
{
int n;
int pn=0;
int a;
int i;
int sa=0;
while (cin >> n, n != 0)
{
sa = 0;
sum = n;
pn = 0;
cin >> a;
puyo[pn].col = a;
puyo[pn].cn = 1;
for (i = 1; i < n; i++)
{
cin >> a;
if (puyo[pn].col == a)
{
puyo[pn].cn++;
}
else
{
pn++;
puyo[pn].col = a;
puyo[pn].cn = 1;
}
}
pn++;
for (i = 1; i < pn - 1; i++)
{
if (puyo[i].cn == 3)
{
if (puyo[i + 1].col == puyo[i - 1].col && puyo[i + 1].cn + puyo[i - 1].cn >= 5)
{
//tmp = puyo[i + 1];
//puyo[i + 1].cn--;
sa = 3 + puyo[i + 1].cn + puyo[i - 1].cn;
sum = min(sum, n - chek(pn, i - 2, i + 2, sa));
//puyo[i + 1] = tmp;
}
}
if( puyo[i+1].cn==1 && puyo[i].col == puyo[i+2].col )
{
if (puyo[i].cn + puyo[i + 2].cn >= 3)
{
//puyo[i + 1].cn--;
sa = 1 + puyo[i].cn + puyo[i + 2].cn;
sum = min(sum, n - chek(pn, i - 1, i + 3, sa));
}
}
/*
if (puyo[i - 1].cn == 1 && puyo[i].col == puyo[i - 2].col)
{
if (puyo[i].cn + puyo[i - 2].cn >= 3)
{
//puyo[i - 1].cn--;
sa = 1 + puyo[i].cn + puyo[i - 2].cn;
sum = min(sum, n - chek(pn, i - 3, i + 1, sa));
}
}
}
*/
cout << sum << endl;
}
return 0;
}
int chek(int pn/*, PR tp[10000 + 10]*/, int go, int ba , int sa)
{
if (puyo[go].col == puyo[ba].col && puyo[go].cn + puyo[ba].cn >= 4)
{
sa += puyo[go].cn + puyo[ba].cn;
if (go - 1 >= 0 && ba + 1 < pn)
{
return chek(pn, go - 1, ba + 1, sa);
}
}
return sa;
} | a.cc: In function 'int main()':
a.cc:107:1: error: a function-definition is not allowed here before '{' token
107 | {
| ^
a.cc:120:2: error: expected '}' at end of input
120 | }
| ^
a.cc:19:1: note: to match this '{'
19 | {
| ^
|
s221286456 | p00457 | C++ | 5000
1
1
2
3
1
2
2
1
1
2
2
3
3
2
3
3
1
3
1
2
1
2
3
1
2
3
1
1
2
2
2
3
3
2
3
2
2
1
2
3
3
1
3
3
2
3
2
3
2
2
2
1
1
3
2
2
2
3
3
2
1
2
1
3
2
1
2
1
1
2
2
2
1
2
2
3
2
2
2
3
2
3
3
3
1
2
2
3
1
3
2
1
2
1
3
3
2
2
2
3
1
1
3
3
3
2
1
3
2
1
1
2
2
1
2
1
2
1
1
2
2
1
3
3
2
1
2
3
2
1
2
3
1
2
1
2
1
3
3
3
1
2
3
1
3
2
3
1
2
2
2
3
2
3
3
1
1
2
3
1
2
3
1
2
3
1
3
1
3
2
3
2
1
1
1
3
3
1
2
1
3
3
1
3
1
3
3
1
1
2
2
3
3
1
1
1
2
3
3
3
1
3
3
2
1
2
3
1
1
1
3
2
1
3
1
1
3
2
3
1
3
2
1
3
1
2
3
3
1
1
3
3
2
1
1
2
1
2
2
3
2
2
2
1
3
1
3
2
2
3
1
2
1
3
2
2
2
1
3
3
2
3
2
2
2
1
2
1
2
2
1
3
1
3
1
3
1
3
2
2
2
1
3
3
1
2
1
3
3
3
2
1
1
1
2
2
3
1
1
2
1
1
3
1
3
1
1
1
2
1
2
3
3
2
3
1
1
1
2
3
1
2
2
3
1
2
1
1
3
2
2
3
3
1
1
2
2
3
3
2
1
3
1
1
3
1
2
2
2
3
3
2
3
1
3
3
1
1
3
2
2
2
1
1
3
1
2
1
1
1
3
3
1
1
3
1
3
3
1
1
3
2
2
2
3
3
3
1
2
3
1
2
3
3
3
1
2
1
1
3
2
1
1
2
2
2
1
1
2
1
3
2
1
2
1
3
1
2
2
2
1
2
2
2
1
2
3
3
1
2
1
3
3
1
1
1
3
2
1
1
3
3
2
1
1
2
1
1
1
3
3
3
2
1
1
3
2
1
3
1
3
3
1
1
2
1
3
3
2
3
3
1
1
3
3
2
1
2
1
3
1
1
3
1
2
1
3
3
2
3
2
1
2
1
3
2
1
3
1
1
1
3
2
2
3
1
1
2
2
1
3
2
1
3
2
2
2
1
3
1
1
3
2
3
3
3
2
1
1
1
3
3
2
1
1
3
2
3
1
3
3
3
2
3
1
2
2
1
2
3
1
2
3
3
1
1
1
3
3
1
1
1
3
2
2
2
3
1
2
3
2
1
3
1
1
1
2
1
3
2
3
3
3
1
1
1
3
1
1
1
2
3
1
2
3
2
2
1
2
1
2
2
2
1
1
3
2
3
2
3
3
3
1
3
2
1
1
2
2
1
1
1
3
1
3
2
3
2
1
2
1
2
3
1
3
1
3
3
1
2
2
2
3
2
1
2
2
1
2
3
1
1
1
3
1
2
3
3
3
1
2
3
2
3
2
3
1
2
2
3
3
2
3
3
1
3
1
3
3
2
1
1
2
1
3
1
2
1
1
1
3
2
1
1
1
3
3
3
2
3
1
2
1
2
2
1
2
3
3
1
3
1
3
1
2
2
2
3
2
2
1
2
1
3
2
2
1
2
3
1
3
1
1
3
2
3
1
1
3
3
1
2
3
1
1
3
1
1
1
3
2
2
1
2
1
3
1
3
1
1
3
1
1
2
2
2
3
1
3
2
1
1
3
1
3
1
2
2
2
1
1
1
2
3
1
3
2
3
3
3
1
2
1
1
1
3
1
2
3
1
3
3
2
3
2
3
1
3
2
3
3
2
1
3
1
1
3
2
2
2
3
2
1
3
3
1
3
2
3
3
2
1
1
1
3
1
2
2
1
1
2
1
1
2
3
3
3
2
3
1
1
2
3
1
1
3
2
1
1
1
2
2
2
1
2
1
2
3
1
3
1
3
2
2
1
2
1
3
3
2
3
2
3
2
1
2
1
3
1
3
2
3
1
2
3
2
2
2
1
2
2
3
2
1
3
1
3
1
1
2
2
1
2
2
1
2
3
2
1
2
1
2
3
3
3
2
1
3
1
2
3
2
3
3
3
1
2
1
1
1
2
3
2
3
1
1
1
3
2
3
3
1
3
3
2
3
2
3
2
2
2
1
1
1
3
1
3
2
1
3
1
3
1
3
3
1
1
3
2
1
2
3
3
3
1
1
1
2
1
2
2
1
2
2
3
3
2
1
2
1
3
1
3
1
3
1
3
3
3
1
3
2
3
2
1
3
1
2
2
1
2
1
1
2
3
1
2
1
2
2
3
3
1
3
2
3
3
2
2
1
2
1
2
1
3
1
2
1
3
1
3
1
2
1
2
2
2
3
3
2
1
3
1
1
1
2
2
3
2
3
1
2
3
3
3
2
2
2
1
2
2
2
3
3
2
2
2
3
3
1
3
1
1
2
3
3
2
1
2
3
1
3
3
3
1
3
2
1
3
1
2
2
3
2
2
3
2
3
1
2
2
1
1
1
2
3
2
3
2
3
3
3
1
2
1
2
3
3
2
3
2
2
1
3
1
1
2
3
3
3
1
2
3
2
3
1
3
1
1
1
3
2
1
1
1
3
1
1
1
2
2
2
3
3
2
2
3
3
3
2
1
3
3
1
2
1
3
1
2
1
1
2
2
2
3
2
1
3
2
1
3
2
2
3
2
3
1
1
3
3
2
1
1
2
3
1
1
1
2
3
1
2
1
1
3
1
2
3
1
1
3
3
1
2
1
2
1
2
3
3
3
2
2
1
2
3
3
3
1
2
3
1
3
2
2
1
3
1
1
2
1
3
1
3
1
3
3
3
1
2
1
2
1
2
1
3
1
1
1
3
3
3
1
2
3
2
3
2
1
3
1
2
1
2
3
2
2
1
2
2
1
2
3
3
3
1
3
1
2
3
3
2
2
1
1
1
2
2
1
1
3
1
3
2
1
1
3
2
1
3
1
1
2
1
2
1
2
2
2
1
1
3
2
2
3
2
1
1
2
1
2
1
3
1
3
3
2
2
1
3
3
2
3
2
1
3
1
3
3
3
1
2
2
3
2
2
2
1
3
3
3
2
1
3
2
1
2
1
3
2
1
2
3
3
3
1
3
1
1
2
1
3
1
1
3
3
3
2
3
2
2
2
3
1
3
3
2
3
3
1
3
2
1
2
2
2
3
3
2
1
1
2
3
3
1
3
3
1
3
2
3
1
2
1
3
1
1
2
2
3
1
3
3
3
1
1
3
1
1
1
2
2
1
3
1
1
2
1
1
3
3
1
1
3
2
1
1
3
2
2
1
1
2
1
3
2
2
2
1
1
1
2
3
2
1
3
2
2
1
1
1
2
2
2
3
1
1
1
3
2
1
3
3
2
3
1
1
3
2
1
1
1
2
3
1
1
1
2
3
2
1
1
2
1
1
2
2
2
1
2
2
3
1
1
1
2
2
1
2
2
3
2
2
2
3
1
2
2
2
1
1
2
1
2
2
2
1
1
2
3
3
1
2
1
2
2
2
3
3
2
3
3
1
2
1
3
1
3
2
3
3
3
1
3
1
3
2
1
1
2
3
3
1
1
3
1
1
2
1
1
1
2
3
2
3
1
2
2
1
3
3
1
3
2
2
3
2
3
1
2
2
3
1
3
2
1
3
2
3
1
1
3
1
1
1
2
1
1
2
1
1
3
3
2
1
2
2
1
1
1
2
2
3
3
1
1
3
1
1
1
2
3
1
1
2
3
1
2
1
1
2
2
3
1
1
3
1
1
2
2
2
1
1
3
2
1
1
1
2
1
1
1
2
1
3
1
2
1
3
3
1
2
2
1
3
3
3
1
1
1
2
2
1
2
1
1
1
3
2
1
1
3
1
3
1
3
2
3
1
1
2
1
3
2
3
1
2
3
3
2
1
2
1
3
1
3
3
1
3
1
3
3
3
2
1
2
3
3
1
1
3
1
2
2
3
2
3
3
3
2
1
1
3
2
3
1
1
3
1
1
3
2
2
3
3
2
2
1
2
3
1
2
3
2
3
1
3
1
2
2
3
2
3
3
1
3
2
3
3
3
1
3
1
2
2
2
1
3
3
2
1
1
3
2
2
2
3
2
3
2
3
3
2
3
3
2
1
2
2
1
3
2
1
2
1
1
2
2
2
1
1
3
2
3
3
3
1
3
2
2
3
3
3
1
1
2
2
3
2
1
2
3
3
3
1
3
1
3
1
1
1
3
2
2
2
1
3
2
1
3
3
3
1
1
3
3
1
1
3
1
1
3
2
2
3
1
3
2
3
3
2
2
2
1
2
3
3
3
2
2
1
1
1
2
1
1
1
3
3
3
2
1
2
1
3
2
2
1
2
2
1
3
2
2
1
3
3
1
1
3
1
2
3
1
3
1
1
1
2
1
2
2
3
1
3
2
2
1
2
1
3
1
1
3
1
2
1
1
1
2
1
1
3
3
1
2
3
1
3
1
2
3
3
3
1
2
3
3
2
3
2
3
3
1
1
1
2
2
2
3
3
1
3
3
1
1
1
2
1
1
2
2
2
3
1
1
2
2
3
2
2
3
3
3
1
2
1
2
2
3
3
2
1
3
3
3
1
2
2
3
1
2
3
2
2
1
1
3
3
1
2
3
2
2
2
1
1
3
3
2
1
2
3
3
1
3
2
3
2
1
3
2
3
3
3
1
2
2
3
3
1
2
3
3
2
3
2
1
1
1
2
1
1
3
3
2
2
1
2
1
1
2
3
2
2
3
2
3
1
3
1
3
2
3
3
1
1
1
2
3
3
2
1
1
1
2
3
3
2
3
1
2
3
3
1
3
3
3
1
1
3
2
2
3
1
2
3
2
2
2
3
3
2
2
3
1
3
3
1
1
1
2
1
3
1
3
1
1
1
2
1
2
1
3
3
3
1
2
2
2
1
3
1
3
3
3
2
2
2
3
2
3
3
1
1
1
3
3
1
2
3
1
1
1
2
3
2
1
1
2
2
3
1
2
2
3
3
2
3
3
3
1
2
2
3
2
2
3
2
3
2
3
2
3
1
3
2
1
3
3
2
2
1
1
2
1
2
2
1
2
3
3
1
1
3
1
1
2
1
2
2
1
2
1
2
2
2
1
3
1
2
2
1
2
2
2
1
1
1
3
3
3
2
1
2
3
1
1
2
1
2
2
3
2
1
1
1
3
2
2
1
3
3
3
2
1
3
1
2
2
1
2
1
2
1
1
2
1
3
1
1
3
1
1
2
1
3
2
1
3
3
1
3
3
2
1
2
1
1
2
1
3
3
3
1
1
2
3
2
1
2
1
1
3
1
3
1
3
1
3
3
2
1
2
1
2
2
2
1
3
1
2
3
1
3
2
3
2
3
2
2
1
3
2
3
2
3
3
3
2
2
1
3
1
1
1
3
3
1
2
2
1
2
1
3
1
1
1
3
1
3
2
3
2
3
2
1
2
3
1
1
3
3
2
1
1
3
3
2
3
1
1
2
1
3
1
2
2
1
1
3
1
2
2
3
3
1
3
2
3
3
1
3
1
1
2
3
2
2
2
3
1
3
3
1
3
1
3
3
3
1
2
1
1
3
2
1
3
3
2
3
2
1
1
1
2
1
3
2
2
2
1
1
2
1
3
3
1
1
1
2
2
3
3
3
1
3
3
3
1
1
1
3
3
1
1
2
2
2
1
2
2
2
3
3
3
1
1
3
3
3
2
3
3
2
2
3
1
1
1
2
2
2
3
3
3
2
2
2
1
1
2
3
3
2
3
1
1
3
3
1
2
2
2
3
3
3
1
1
1
2
2
3
3
3
1
1
3
1
1
2
3
1
1
1
2
1
1
2
2
3
3
3
2
1
1
3
3
3
1
1
2
3
3
3
1
1
2
2
3
3
3
1
2
2
2
3
3
1
1
1
3
3
1
1
3
3
3
1
1
1
2
2
2
3
3
3
2
3
3
2
3
2
2
1
1
1
3
2
2
3
3
1
1
2
2
1
1
1
3
3
3
2
2
1
1
2
2
2
3
2
2
3
3
3
2
2
2
3
3
3
2
2
2
1
2
2
3
3
2
2
2
3
1
2
2
1
2
2
2
3
3
3
1
3
3
2
1
2
1
1
2
2
3
1
1
3
3
2
1
1
2
2
3
3
1
1
3
3
3
2
2
2
3
1
1
1
2
2
2
3
3
2
2
1
1
3
2
2
3
3
3
2
2
2
1
1
2
1
1
1
2
2
2
3
1
1
2
3
3
3
2
2
2
3
3
1
1
3
3
3
1
1
3
3
3
1
1
1
2
3
3
3
1
3
3
2
1
1
3
2
2
3
3
3
2
2
2
3
3
1
1
2
2
1
1
2
2
3
3
3
1
1
1
3
3
3
1
2
3
3
3
1
1
3
3
2
2
3
1
1
1
3
3
3
2
1
1
1
3
2
1
1
3
3
2
2
1
3
3
3
2
1
1
1
2
2
3
1
1
2
2
2
1
1
1
3
3
1
1
3
3
1
2
1
1
3
2
2
2
1
1
1
2
2
2
1
1
1
3
3
2
1
1
1
2
2
1
1
3
3
2
1
2
3
3
3
1
1
2
1
1
1
3
3
3
2
3
3
3
2
2
1
1
2
2
2
1
1
2
2
1
1
2
2
3
3
2
2
2
3
3
2
2
3
1
1
2
2
1
1
2
2
3
3
2
1
1
1
2
2
1
1
3
3
3
1
3
2
1
3
3
2
2
2
1
3
3
1
1
2
2
2
1
1
1
2
1
1
1
2
2
3
3
3
2
3
2
1
1
2
2
1
1
1
2
2
1
2
2
1
1
2
1
1
3
3
2
2
2
1
1
3
3
3
2
2
1
3
2
1
1
2
2
2
1
3
3
2
1
2
2
3
2
2
2
1
3
3
3
1
3
3
3
1
1
1
3
3
1
1
2
2
2
3
3
2
2
1
2
2
2
3
2
1
1
3
3
2
2
3
3
2
1
1
2
1
1
1
2
2
2
1
1
1
2
2
2
1
2
2
2
3
2
2
2
3
3
3
2
2
3
3
2
2
2
1
1
2
3
3
3
2
2
2
1
1
1
2
2
3
3
3
1
3
3
1
3
3
3
1
3
3
2
2
1
1
1
2
1
3
3
2
2
1
1
1
2
3
3
1
1
1
3
3
3
1
1
1
2
2
3
3
2
2
3
3
3
1
1
1
2
3
3
1
3
3
3
2
2
1
1
2
2
1
1
2
2
3
3
3
2
2
2
3
3
1
1
2
2
2
1
3
1
3
3
3
2
2
3
3
1
1
2
2
1
1
3
3
3
1
1
2
2
2
1
1
2
2
2
3
3
3
1
2
3
2
1
1
2
1
1
1
2
2
2
3
2
2
2
1
3
1
2
2
3
2
3
3
1
2
2
1
1
3
3
3
2
2
2
1
1
1
2
2
3
1
3
1
3
1
2
2
3
3
1
2
2
2
1
1
3
1
1
2
2
1
2
2
3
3
3
2
1
1
1
2
2
2
1
1
1
2
2
2
1
1
3
3
3
2
1
1
1
3
3
2
2
1
2
2
2
1
3
3
3
1
1
1
3
3
1
2
2
2
3
1
1
3
3
1
1
3
2
2
2
1
1
1
3
3
1
1
1
2
2
3
3
3
2
2
2
1
2
2
2
3
3
3
2
1
1
2
2
1
3
1
1
1
2
1
1
1
3
3
3
1
1
3
3
1
1
1
2
2
1
1
1
2
2
2
1
1
3
3
2
2
2
1
1
2
2
2
1
1
3
3
3
1
1
1
3
1
1
3
1
1
2
2
2
1
1
1
3
3
3
1
1
2
3
3
3
1
1
3
3
2
2
1
1
1
2
2
2
1
1
2
2
3
3
3
2
2
2
3
3
3
2
1
1
2
2
3
3
3
2
2
1
1
2
2
1
1
1
3
3
1
2
1
1
1
3
3
3
1
2
2
1
1
2
2
3
3
2
2
2
1
1
1
2
2
2
3
2
2
2
3
3
3
2
2
1
1
2
2
1
1
2
2
3
3
1
1
1
3
3
3
2
2
2
1
1
1
3
1
2
2
1
1
3
3
3
1
1
3
3
3
1
3
1
1
2
2
2
1
1
1
2
2
2
3
3
3
1
1
2
2
1
1
2
2
2
1
1
1
3
3
1
1
3
3
3
1
1
2
2
2
1
1
3
3
3
1
1
1
2
2
2
1
1
2
2
2
3
2
1
1
1
2
2
3
3
3
2
2
1
3
3
3
1
1
1
2
2
2
3
3
3
1
1
1
3
3
3
1
1
1
3
3
3
2
1
1
1
3
3
1
1
1
3
3
3
1
1
1
2
1
1
1
2
2
3
3
3
1
1
2
2
2
3
3
1
1
1
2
2
1
1
2
2
2
1
1
1
2
2
2
3
3
3
2
2
1
1
1
2
2
1
1
1
3
3
3
1
1
2
2
2
1
1
1
3
3
2
2
1
1
1
3
3
3
1
1
1
3
3
3
1
1
1
3
3
3
2
2
2
1
1
2
3
3
1
1
2
2
1
1
1
3
3
2
2
2
3
3
3
2
2
1
1
1
3
3
3
1
1
1
2
3
3
3
2
2
1
1
1
2
2
2
1
1
2
2
2
3
3
3
2
2
2
1
1
1
3
2
2
1
1
1
2
2
1
1
1
3
1
1
2
2
1
1
1
3
3
3
2
2
3
3
3
1
1
1
3
3
3
1
1
1
2
2
2
1
1
3
3
3
2
2
2
3
3
3
2
2
1
1
1
2
2
2
1
1
1
2
2
2
3
3
1
1
1
3
3
3
2
2
2
1
1
3
3
2
2
2
3
3
3
2
2
1
1
3
3
1
1
3
3
2
2
2
1
2
2
2
3
3
1
1
1
2
2
2
1
1
1
2
2
3
3
1
1
1
3
3
3
1
1
1
3
3
1
1
1
3
2
2
2
1
1
1
2
3
2
2
2
1
1
1
2
2
3
3
2
2
3
3
3
2
2
2
3
3
3
2
1
1
1
2
2
1
1
2
2
2
1
2
2
2
1
1
1
2
2
2
3
3
2
2
2
3
3
3
1
1
1
2
2
2
3
3
3
2
1
1
1
2
2
3
3
3
2
2
1
1
3
3
3
1
1
3
3
3
1
1
1
3
1
1
1
2
2
3
3
3
2
2
2
1
1
1
2
2
2
3
3
3
1
1
1
2
1
1
2
2
2
3
3
3
1
1
1
2
2
3
1
1
1
2
2
3
3
3
1
1
1
2
2
2
1
1
2
2
2
1
1
1
2
2
2
1
1
1
2
2
1
1
1
2
2
2
3
3
3
2
2
2
3
2
2
2
1
1
1
2
2
2
1
2
2
2
1
1
3
3
1
1
1
2
2
3
3
1
1
1
2
2
2
3
3
3
1
1
1
3
3
3
1
1
1
2
2
2
1
1
1
2
2
2
3
3
3
2
2
2
1
1
1
2
2
1
1
3
3
3
2
2
2
3
3
2
2
2
3
3
3
2
2
2
1
1
2
2
1
1
1
2
2
2
1
1
2
2
3
2
2
2
3
1
1
1
2
2
2
1
1
3
2
2
2
1
1
1
2
2
2
3
3
3
1
1
2
2
2
1
2
2
2
3
3
3
1
1
2
2
1
1
1
2
3
3
3
1
1
2
2
2
1
1
1
3
3
3
1
1
3
3
3
1
1
2
2
1
1
3
3
3
2
2
1
1
2
2
2
3
3
1
1
1
2
2
3
3
3
1
1
1
2
2
2
3
3
3
1
2
2
2
3
1
3
3
3
2
2
3
3
3
1
1
3
3
3
2
2
2
1
1
1
3
3
1
3
2
2
1
1
1
2
2
2
1
1
3
3
2
2
3
3
2
2
2
3
3
3
1
1
1
2
2
2
3
3
1
1
1
3
2
2
2
1
1
1
3
1
1
1
3
3
3
1
1
3
3
2
2
3
2
2
2
1
1
1
3
3
3
2
2
2
1
2
2
2
1
1
2
2
2
3
3
2
2
2
3
3
3
1
1
2
2
3
3
2
2
1
3
3
3
2
2
3
3
3
1
1
3
3
2
2
2
1
1
1
2
2
2
3
3
3
1
1
3
3
3
2
2
1
1
2
2
2
1
1
1
2
2
2
3
3
3
1
1
1
3
3
3
2
2
1
1
1
2
2
2
1
1
1
3
3
3
2
3
3
3
2
2
1
1
1
2
3
3
3
2
2
3
3
2
2
2
3
3
3
2
2
2
1
1
1
2
2
2
3
1
1
2
2
2
1
1
1
3
3
2
2
2
3
3
3
1
2
2
3
3
3
2
2
2
3
3
3
2
2
2
3
3
2
1
1
3
3
1
1
1
3
3
1
1
1
3
3
3
2
1
1
1
3
3
2
2
1
1
3
3
2
2
2
1
1
3
3
3
1
1
2
2
2
3
2
2
1
1
2
2
2
1
1
3
3
3
2
2
2
1
1
3
3
3
1
1
1
3
3
2
2
2
1
1
3
3
3
2
2
2
1
1
1
3
3
1
1
1
3
3
3
2
2
2
3
3
3
2
2
2
1
1
1
2
2
2
3
3
2
2
2
1
3
3
3
2
2
2
3
3
2
2
2
3
1
1
1
3
3
2
2
1
1
1
2
2
2
1
1
3
3
3
1
1
1
3
3
3
1
1
1
3
3
2
2
2
1
1
3
3
3
1
1
1
2
2
2
1
1
3
2
3
1
2
3
3
2
2
3
1
3
2
3
1
1
1
3
3
1
2
3
2
2
3
1
1
3
3
2
1
1
1
2
3
3
1
3
1
1
1
2
3
2
3
2
2
2
3
1
1
2
1
3
3
3
2
3
2
1
1
3
3
2
1
2
2
3
2
1
3
1
1
2
1
2
1
2
3
1
3
3
2
1
3
2
2
3
2
2
1
2
3
2
1
3
1
2
1
2
3
1
3
3
1
1
1
3
2
3
3
2
2
3
1
3
3
2
2
1
1
2
1
2
3
2
3
3
1
3
1
2
2
1
1
2
1
1
2
1
1
1
2
2
1
3
2
3
2
3
3
2
2
1
2
3
3
1
2
3
2
3
3
2
2
1
2
1
3
3
2
3
1
3
2
1
1
3
1
3
2
3
1
2
2
3
2
2
2
1
2
3
2
3
1
1
1
3
1
1
2
2
1
2
1
2
3
1
2
1
2
1
2
1
1
1
3
2
2
3
1
3
1
3
1
3
2
3 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 5000
| ^~~~
|
s973291971 | p00457 | C++ | #include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 100001
#define dmp make_pair
#define dpb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);
int a[10000];
int solve(int p, int n){
int l = p-1, r = p+1, t;
int s1, s2, ans = 0, f = 1;
while(0 <= l){
t = a[l];
s1 = s2 = 0;
if(f)s1 = 1, f = 0;
//if(p == 5)printf("%d %d %d\n", l, r, t);
while(0 <= l && a[l] == t){
s1++;l--;
}
while(r < n && a[r] == t){
s2++;r++;
}
if(s1+s2 >= 4){
ans += s1+s2;
}else break;
}
return n-ans;
}
int main(){
int n, ans;
while(){
scanf("%d", &n);
ans = INF;
rep(i,n)scanf("%d", &a[i]);
for(int i = 1;i < n-1;i++){
ans = min(ans, solve(i, n));
}
if(ans == INF)printf("%d\n", n-1);
else printf("%d\n", ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:15: error: expected primary-expression before ')' token
39 | while(){
| ^
|
s672362287 | p00457 | C++ | #include<iostream>
#include<vector>
using namespace std;
int check(vector<int> c)
{
bool f=1;
int cnt,i,j;
vector<int>::iterator it,it2;
while(f){
cnt=f=0;
it=it2=c.begin();
for(it++;it!=c.end();it++){
if(*it==*it2){
cnt++;
}else if(cnt>=3){
for(;cnt>=0;cnt--){
it--;
it2=it;
c.erase(it2);
}
f=1;
break;
}else{
cnt=0;
}
it2=it;
}
}
return c.size();
}
int main()
{
int N,i,j;
int min,rest;
while(cin>>N,N){
vector<int> chara(N);
for(i=0;i<N;i++)cin>>chara[i];
min=INT_MAX;
for(i=0;i<N;i++){
for(j=1;j<=3;j++){
if(chara[i]==j)continue;
int t=chara[i];
chara[i]=j;
rest=check(chara);
chara[i]=t;
if(min>rest)min=rest;
}
}
printf("%d\n",min);
}
} | a.cc: In function 'int main()':
a.cc:39:9: error: 'INT_MAX' was not declared in this scope
39 | min=INT_MAX;
| ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
2 | #include<vector>
+++ |+#include <climits>
3 | using namespace std;
|
s046055131 | p00457 | C++ | #include<cstdio>
#include<vector>
#include<algorithm>
#include<stack>
using namespace std;
#define PII pair<int,int>
int x[10020];
int N;
vector< PII > S;
void pa(){
for(int i = 0; i < N; i++){
printf("%s",x[i]==1?"Ô":x[i]==2?"Â":"©");
}puts("");
}
int func(){
int now = 1;
int ret = 0;
PII t;
for(int i = 0; i < N ; i++){
if(x[i] == x[i+1]){
now++;
}else{
if(S.size() > 0){
// printf("%sª%2dÂ\n", S.top().first==1?"Ô":S.top().first==2?"Â":"©", S.top().second);
if(now > 3){
}else if(S.top().first == x[i] && S.top().second + now > 3){
// printf("popA\n");
S.pop();
}else{
t.first = x[i];
t.second = now;
S.push(t);
}
}else{
PII t;
t.first = x[i];
t.second = now;
S.push(t);
}
now = 1;
}
}
/*
if(x[N-1] == S.top().first && S.top().second > 2){
S.pop();
}else {
S.push(PII(x[N-1],1));
}
*/
// printf("size() = %d\n",S.size());
int size = S.size();
for(int i = 0; i < size; i++){
// printf("%sª%2dÂ\n", S.top().first==1?"Ô":S.top().first==2?"Â":"©", S.top().second);
ret += S.top().second;
S.pop();
}
// printf("return %2d\n",ret);
return ret;
}
int main(void){
while(scanf("%d", &N) && N != 0){
int M=2000000000;
for(int i = N-1; i >= 0; i--){
scanf("%d", &x[i]);
}
x[N] = 0;
// pa();
for(int i = 0; i < N; i++){
for(int j = 1; j < 4; j++){
if(x[i] != j && ( x-1 > -1 && x[i-1] == x[i]) || (x[i] == x[i+1]) ){
x[N+1] = x[i];
x[i] = j;
// puts("---");
// pa();
M = min(func(),M);
x[i] = x[N+1];
}
}
}
printf("%d\n", M);
}
return 0;
} | a.cc: In function 'int func()':
a.cc:34:44: error: 'class std::vector<std::pair<int, int> >' has no member named 'top'
34 | }else if(S.top().first == x[i] && S.top().second + now > 3){
| ^~~
a.cc:34:69: error: 'class std::vector<std::pair<int, int> >' has no member named 'top'
34 | }else if(S.top().first == x[i] && S.top().second + now > 3){
| ^~~
a.cc:36:43: error: 'class std::vector<std::pair<int, int> >' has no member named 'pop'
36 | S.pop();
| ^~~
a.cc:40:43: error: 'class std::vector<std::pair<int, int> >' has no member named 'push'
40 | S.push(t);
| ^~~~
a.cc:46:35: error: 'class std::vector<std::pair<int, int> >' has no member named 'push'
46 | S.push(t);
| ^~~~
a.cc:62:26: error: 'class std::vector<std::pair<int, int> >' has no member named 'top'
62 | ret += S.top().second;
| ^~~
a.cc:63:19: error: 'class std::vector<std::pair<int, int> >' has no member named 'pop'
63 | S.pop();
| ^~~
a.cc: In function 'int main()':
a.cc:81:55: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
81 | if(x[i] != j && ( x-1 > -1 && x[i-1] == x[i]) || (x[i] == x[i+1]) ){
| ~~~~^~~~
|
s679535822 | p00457 | C++ | <?php
class AOJ0534 {
var $T;
var $TC;
var $L;
var $LC;
public function init() {
$L = &$this->L;
$LC = &$this->LC;
$T = &$this->T;
$TC = &$this->TC;
$in = file_get_contents('/dev/stdin');
$L = explode( "\n", trim($in) );
$LC = count($L);
$T = array();
$TC = 0;
}
public function input() {
$L = &$this->L;
$LC = &$this->LC;
$T = &$this->T;
$TC = &$this->TC;
for ( $i = 0; $i < $LC; ++ $i ) {
if ( $L[$i] == "0" ) break;
$n = $L[$i++];
$T[$TC] = array();
for ( $j = 0; $j < $n; ++ $j ) {
$T[$TC][] = intval($L[$i++]);
}
$TC++;
$i--;
}
}
public function check($s) {
for ( $i = 1; $i <= 3; ++ $i ) {
$key = str_repeat( $i, 4 );
if ( strstr( $s, $key ) ) return true;
}
return false;
}
public function calc($s) {
while ( $this->check($s) ) {
for ( $i = 1; $i <= 3; ++ $i ) {
$regexp = "/".$i."{4,}/";
$s = preg_replace( $regexp, '', $s );
}
}
return $res = strlen($s);
}
public function check_around( $s, $k ) {
$res = 0;
$n = strlen($s);
for ( $i = 0; $i < 4; ++ $i ) {
$id = $k - $i - 1;
if ( $id < 0 ) break;
if ( $s[$k] != $s[$id] ) break;
$res ++;
}
for ( $i = 0; $i < 4; ++ $i ) {
$id = $k + $i + 1;
if ( $id >= $n ) break;
if ( $s[$k] != $s[$id] ) break;
$res ++;
}
return $res + 1;
}
public function solve($s_) {
$res = PHP_INT_MAX;
$s = implode('', $s_);
for ( $i = 1; $i <= 3; ++ $i ) {
$regexp = "/".$i."{4,}/";
$s = preg_replace( $regexp, str_repeat($i, 4), $s );
}
$n = strlen($s);
for ( $i = 0; $i < $n; ++ $i ) {
$t = $s;
for ( $j = 1; $j <= 3; ++ $j ) {
if ( $t[$i] == $j ) continue;
$t[$i] = $j;
if ( $this->check_around( $t, $i ) < 4 ) continue;
if ( ( $i-1 >= 0 && $t[$i-1] == $j ) || ( $i+1 < $n && $t[$i+1] == $j ) ) {
$res = min( $res, $this->calc($t) );
}
}
}
return $res;
}
public function run() {
$this->init();
$this->input();
foreach ( $this->T as $test ) {
echo $this->solve($test)."\n";
}
}
}
$instance = new AOJ0534;
$instance->run(); | a.cc:14:33: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
14 | $in = file_get_contents('/dev/stdin');
| ^~~~~~~~~~~~
a.cc:51:45: error: empty character constant
51 | $s = preg_replace( $regexp, '', $s );
| ^~
a.cc:77:22: error: empty character constant
77 | $s = implode('', $s_);
| ^~
a.cc:1:1: error: expected unqualified-id before '<' token
1 | <?php
| ^
a.cc:105:1: error: '$instance' does not name a type
105 | $instance = new AOJ0534;
| ^~~~~~~~~
a.cc:106:1: error: '$instance' does not name a type
106 | $instance->run();
| ^~~~~~~~~
|
s660517343 | p00457 | C++ |
class P
attr_accessor :color, :size
def initialize(color=0, size=0)
@color = color
@size = size
end
end
# [Pair] -> [Pair]
def compless1(v)
res = [v[0]]
v[1..(-1)].each do |e|
if e.color == res[-1].color
res[-1].size += e.size
else
res << e
end
end
res
end
# [Int] -> [Pair]
def compless2(v)
res = []
v.each{ |e| res << P.new(e, 1) }
compless1(res)
end
# main
while (n = gets.chomp.to_i) != 0
chain = []
n.times { chain << gets.chomp.to_i }
best = 0
n.times do |i|
1.upto(3) do |color|
buf = chain.dup
buf[i] = color
v = compless2(buf)
cnt = 0
loop do
v = compless1(v)
nv = v.reject{ |e| e.size >= 4 }
break if v == nv
cnt += v.inject(0) { |acc, e| acc + (e.size >= 4 ? e.size : 0) }
v = nv
break if v == []
end
best = [best, cnt].max
end
end
puts (n - best)
end | a.cc:5:5: error: stray '@' in program
5 | @color = color
| ^
a.cc:6:5: error: stray '@' in program
6 | @size = size
| ^
a.cc:10:3: error: invalid preprocessing directive #[
10 | # [Pair] -> [Pair]
| ^
a.cc:14:5: error: too many decimal points in number
14 | v[1..(-1)].each do |e|
| ^~~
a.cc:25:3: error: invalid preprocessing directive #[
25 | # [Int] -> [Pair]
| ^
a.cc:36:3: error: invalid preprocessing directive #main
36 | # main
| ^~~~
a.cc:3:17: error: found ':' in nested-name-specifier, expected '::'
3 | attr_accessor :color, :size
| ^
| ::
a.cc:3:3: error: 'attr_accessor' has not been declared
3 | attr_accessor :color, :size
| ^~~~~~~~~~~~~
a.cc:3:18: error: aggregate 'P color' has incomplete type and cannot be defined
3 | attr_accessor :color, :size
| ^~~~~
a.cc:3:25: error: expected unqualified-id before ':' token
3 | attr_accessor :color, :size
| ^
a.cc:31:12: error: expected constructor, destructor, or type conversion before '(' token
31 | compless1(res)
| ^
a.cc:41:3: error: 'best' does not name a type
41 | best = 0
| ^~~~
a.cc:54:9: error: expected unqualified-id before 'break'
54 | break if v == nv
| ^~~~~
a.cc:56:9: error: 'v' does not name a type
56 | v = nv
| ^
|
s523075829 | p00458 | Java | d
| Main.java:1: error: reached end of file while parsing
?
^
1 error
|
s455270992 | p00458 | Java | import java.util.*;
public class Main {
static int n, m, ans;
static int[] dx = {0,0,-1,1}, dy = {-1,1,0,0};
static boolean[][] map, check;
public static void dfs (int y, int x, int step) {
max[y][x] = step;
check[y][x] = true;
boolean f = true;
for (int i = 0; i < dx.length; i++) {
int nextX = x + dx[i];
int nextY = y + dy[i];
if (0 <= nextX && nextX < m &&
0 <= nextY && nextY < n &&
map[nextY][nextX] &&
!check[nextY][nextX]) {
f = false;
dfs(nextY,nextX,step + 1);
}
}
if (f) ans = Math.max(step, ans);
check[y][x] = false;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
ans = -1;
m = sc.nextInt();
n = sc.nextInt();
if (m == 0 && n == 0) break;
max = new int[n][m];
map = new boolean[n][m];
check = new boolean[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
map[i][j] = sc.nextInt() == 1;
if (map[i][j]) {
dfs(i,j,1);
check = new boolean[n][m];
}
}
}
System.out.println(ans);
}
}
} | Main.java:10: error: cannot find symbol
max[y][x] = step;
^
symbol: variable max
location: class Main
Main.java:36: error: cannot find symbol
max = new int[n][m];
^
symbol: variable max
location: class Main
2 errors
|
s775075376 | p00458 | Java | import java.io.*;
public class Main2 {
static int n, m;
static int[] dx = {0,0,-1,1}, dy = {-1,1,0,0};
static boolean[][] map, check;
public static int dfs(int y, int x) {
int ret = 0;
for (int d = 0 ; d < 4 ; d++) {
int nextX = x + dx[d];
int nextY = y + dy[d];
if (0 <= nextX && nextX < m &&
0 <= nextY && nextY < n &&
map[nextY][nextX] &&
!check[nextY][nextX]) {
check[nextY][nextX] = true;
ret = Math.max(dfs(nextY,nextX) + 1,ret);
check[nextY][nextX] = false;
}
}
return ret;
}
public static void main(String[] args) throws IOException {
BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
while (true) {
m = Integer.valueOf(s.readLine());
n = Integer.valueOf(s.readLine());
if (m == 0 && n == 0) break;
map = new boolean[n][m];
for (int i = 0 ; i < n ; i++) {
String[] data = s.readLine().split(" ");
for (int j = 0 ; j < m ; j++)
map[i][j] = Integer.valueOf(data[j]) == 1;
}
int max = 0;
for (int i = 0 ; i < n ; i++) {
for (int j = 0 ; j < m ; j++) {
if (map[i][j]) {
check = new boolean[n][m];
max = Math.max(max, dfs(i, j));
}
}
}
out.println(max);
}
out.flush();
}
} | Main.java:2: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
^
1 error
|
s193466809 | p00458 | C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int InputIce[90][90];
int Ice[92][92];
int way=0;
int height; //???
int width; //?¨?
int count=0,count_z=0;
void Check(int a,int b,int count_z){
//a:height,b:width
//?????????count++??????
count_z++;
//????????????
Ice[a][b]=0;
if(Ice[a-1][b]==1 && a-1>=0){
Check(a-1,b,count_z);
}
if(Ice[a+1][b]==1 && a+1<=height+1){
Check(a+1,b,count_z);
}
if(Ice[a][b-1]==1 && b-1>=0){
Check(a,b-1,count_z);
}
if(Ice[a][b+1]==1 && b+1<=width+1){
Check(a,b+1,count_z);
}
//?????£????°???????????????????
Ice[a][b]=1;
//????????§????????°???count?????\??????
if(count<count_z) count=count_z;
}
int Main(void){
int i,j,n,m;
//?????¨?¨??????°??????????????????
scanf("%d",&width);
scanf("%d",&height);
//?°??????¶??????????????????
for(i=0;i<height;i++){
for(j=0;j<width;j++){
scanf("%d",&InputIce[i][j]);
}
}
//?????????????????????????????????????????????0???????????§??????
for(m=0;m<=width+1;m++) Ice[0][m]=0;
for(n=0;n<=width+1;n++) Ice[height+1][n]=0;
for(i=1;i<=height;i++){
for(j=0;j<=width+1;j++){
if(j==0 || j==width+1) Ice[i][j]=0;
else Ice[i][j]=InputIce[i-1][j-1];
}
}
//??????1?????¨???,Check?????????????????????????????????????????????
for(i=1;i<=height;i++){
for(j=1;j<=width;j++){
if(Ice[i][j]==1) Check(i,j,0);
}
}
//?????????count?????????
printf("%d\n",count);
return 0;
} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s153646286 | p00458 | C | #include <stdio.h>
long tyousa(int,long,int,int,int*);
int main(void) {
int map[92*92];
int mapbak[92*92];
int tate;
int yoko;
int x;
int y;
int i;
long result;
long resultbuf;
while(1) {
scanf("%d",&yoko);
scanf("%d",&tate);
if(yoko==0 && tate==0)break;
for(y=0;y<92;y++) {
for(x=0;x<92;x++) {
mapbak[x+y*92]=0;
}
}
for(y=1;y<tate+1;y++) {
for(x=1;x<yoko+1;x++) {
scanf("%d",&mapbak[x+y*92]);
}
}
fclose(fp);
result=0;
for(y=1;y<tate+1;y++) {
for(x=1;x<yoko+1;x++) {
for(i=0;i<92*92;i++) {
map[i]=mapbak[i];
}
resultbuf=tyousa(0,0,x,y,map);
if(resultbuf>result)result=resultbuf;
}
}
printf("%d\n",result);
}
return 0;
}
long tyousa(int dire,long kazu,int x,int y,int* map) {
long result;
long resultbuf;
long kazubuf;
int i;
int mapbak[92*92];
if(map[x+y*92]==0)return kazu;
map[x+y*92]=0;
for(i=0;i<92*92;i++) {
mapbak[i]=map[i];
}
kazubuf=kazu+1;
result=kazubuf;
if(dire!=3) {
resultbuf=tyousa(1,kazubuf,x-1,y,map);
if(resultbuf>result)result=resultbuf;
}
for(i=0;i<92*92;i++) {
map[i]=mapbak[i];
}
if(dire!=11) {
resultbuf=tyousa(3,kazubuf,x+1,y,map);
if(resultbuf>result)result=resultbuf;
}
for(i=0;i<92*92;i++) {
map[i]=mapbak[i];
}
if(dire!=4) {
resultbuf=tyousa(2,kazubuf,x,y-1,map);
if(resultbuf>result)result=resultbuf;
}
for(i=0;i<92*92;i++) {
map[i]=mapbak[i];
}
if(dire!=2) {
resultbuf=tyousa(4,kazubuf,x,y+1,map);
if(resultbuf>result)result=resultbuf;
}
for(i=0;i<92*92;i++) {
map[i]=mapbak[i];
}
return result;
} | main.c: In function 'main':
main.c:29:24: error: 'fp' undeclared (first use in this function)
29 | fclose(fp);
| ^~
main.c:29:24: note: each undeclared identifier is reported only once for each function it appears in
|
s419156862 | p00458 | C | int X,Y,T[90][90],r;
int R(int x,int y,int d){
if(0<=x&&x<X&&0<=y&&y<Y&&T[y][x]){
T[y][x]=0;
R(x-1,y);
R(x+1,y);
R(x,y-1);
R(x,y+1);
T[y][x]=1;
}else if(r<d)r=d;
}
main(){
int i,j;
for(;scanf("%d%d",&X,&Y),X;printf("%d\n",r)){
for(j=0;j<Y;j++)for(i=0;i<X;i++)scanf("%d",T[j]+i);
for(r=j=0;j<Y;j++)for(i=0;i<X;i++)R(i,j,0);
}
} | main.c: In function 'R':
main.c:5:17: error: too few arguments to function 'R'
5 | R(x-1,y);
| ^
main.c:2:5: note: declared here
2 | int R(int x,int y,int d){
| ^
main.c:6:17: error: too few arguments to function 'R'
6 | R(x+1,y);
| ^
main.c:2:5: note: declared here
2 | int R(int x,int y,int d){
| ^
main.c:7:17: error: too few arguments to function 'R'
7 | R(x,y-1);
| ^
main.c:2:5: note: declared here
2 | int R(int x,int y,int d){
| ^
main.c:8:17: error: too few arguments to function 'R'
8 | R(x,y+1);
| ^
main.c:2:5: note: declared here
2 | int R(int x,int y,int d){
| ^
main.c: At top level:
main.c:12:1: error: return type defaults to 'int' [-Wimplicit-int]
12 | main(){
| ^~~~
main.c: In function 'main':
main.c:14:14: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
14 | for(;scanf("%d%d",&X,&Y),X;printf("%d\n",r)){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int X,Y,T[90][90],r;
main.c:14:14: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
14 | for(;scanf("%d%d",&X,&Y),X;printf("%d\n",r)){
| ^~~~~
main.c:14:14: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:36: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
14 | for(;scanf("%d%d",&X,&Y),X;printf("%d\n",r)){
| ^~~~~~
main.c:14:36: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:36: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:14:36: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s947272451 | p00458 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int v[90][90];int memo[90][90];int a;
void dfs(int x,int y,int count){
a=max(a,count);
memo[x][y]=3;
//cout<<x<<""<<y<<"count "<<count<<endl;
if(v[x-1][y]==1&&memo[x-1][y]!=3){//上
dfs(x-1,y,count+1);
}
if(v[x+1][y]==1&&memo[x+1][y]!=3){//下
dfs(x+1,y,count+1);
}
if(v[x][y+1]==1&&memo[x][y+1]!=3){//右
dfs(x,y+1,count+1);
}
if(v[x][y-1]==1&&memo[x][y-1]!=3){//左
dfs(x,y-1,count+1);
}
}
int main(){
int n,m;
while(cin>>n>>m,n||m){
int answer=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>v[i][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(v[i][j]==0)continue;
dfs(i,j,1);
answer=max(a,answer);
memset(memo,0,sizeof(memo));
}
}
cout<<a<<endl;
memset(v,1,sizeof(v));
a=0;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:25: error: 'memset' was not declared in this scope
46 | memset(memo,0,sizeof(memo));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<algorithm>
+++ |+#include <cstring>
5 | using namespace std;
a.cc:50:9: error: 'memset' was not declared in this scope
50 | memset(v,1,sizeof(v));
| ^~~~~~
a.cc:50:9: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s720086177 | p00458 | C++ | 目
/*#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int a[10],b[10];
for(int i=0;i<10;i++)cin>>a[i];
for(int i=0;i<10;i++)cin>>b[i];
sort(a,a+10);sort(b,b+10);
cout<<a[9]+a[8]+a[7]<<" "<<b[9]+b[8]+b[7]<<endl;
return 0;
}*/
//3問目
/*#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int solve(vector<int>chars,int a,int b){//a番目のキャラをb色に変えたときのシュミレーション
chars[a]=b;
while(true){
bool flag=false;
for(int i=0;i<chars.size()-3;i++){
if(chars[i]==chars[i+1]&&chars[i+1]==chars[i+2]&&chars[i+2]==chars[i+3]){
int j=i;
while(chars[j]==chars[i]){
j++;
}
for(int k=i;k<j;k++){
chars.erase(chars.begin()+i);
}
flag=true;
}
}
if(!flag)break;
}
return chars.size();
}
int main(){
int N,m;
int ans=150000;
while(cin>>N,N){
vector<int>chars;
for(int i=0;i<N;i++)cin>>m,chars.push_back(m);
for(int i=0;i<N;i++){
for(int j=1;j<=3;j++){
ans=min(solve(chars,i,j),ans);
}
}
cout<<ans<<endl;
chars.clear();
ans=15000;
}
return 0;
}/*/
//4問目
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
int v[90][90];int memo[90][90];int a;
void dfs(int x,int y,int count){
a=max(a,count);
memo[x][y]=3;
//cout<<x<<""<<y<<"count "<<count<<endl;
if(v[x-1][y]==1&&memo[x-1][y]!=3){//上
dfs(x-1,y,count+1);
}
if(v[x+1][y]==1&&memo[x+1][y]!=3){//下
dfs(x+1,y,count+1);
}
if(v[x][y+1]==1&&memo[x][y+1]!=3){//右
dfs(x,y+1,count+1);
}
if(v[x][y-1]==1&&memo[x][y-1]!=3){//左
dfs(x,y-1,count+1);
}
}
int main(){
int n,m;
while(cin>>n>>m,n||m){
int answer=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>v[i][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(v[i][j]==0)continue;
dfs(i,j,1);
answer=max(a,answer);
memset(memo,0,sizeof(memo));
}
}
cout<<a<<endl;
memset(v,1,sizeof(v));
a=0;
}
return 0;
} | a.cc:1:1: error: '\U000076ee' does not name a type
1 | 目
| ^~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:72:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
179 | _GLIBCXX_NODISCARD inlin |
s860628641 | p00458 | C++ | #include<cstdio>
#include<queue>
#include<algorithm>
#include<iostream>
using namespace std;
int field[92][92] = { };
int vx[4] = { 1, -1, 0, 0 };
int vy[4] = { 0, 0, 1, -1 };
int ans = 0,ANSW=0;
int dfs(int X, int Y, int n){
if (field[X][Y]==0)return n;
field[X][Y] = 0;
for (int i = 0; i < 4; i++){
ans = max(ans, dfs(X + vx[i], Y + vy[i], n + 1));
}
field[X][Y] = 1;
return ans;
}
int main(){
while (1){
int l, m;
scanf_s("%d%d", &l, &m);
for (int i = 0; i < l; i++){
for (int j = 0; j < m; j++){
cin>> field[i + 1][j + 1];
}
}
for (int i = 0; i < l; i++){
for (int j = 0; j < m; j++){
if (field[i + 1][j + 1])ANSW = max(ANSW, dfs(i + 1, j + 1, 0));
}
}
printf("%d\n", ANSW);
}
} | a.cc: In function 'int main()':
a.cc:26:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
26 | scanf_s("%d%d", &l, &m);
| ^~~~~~~
| scanf
|
s196693258 | p00458 | C++ | #include <cstdio>
#include <algorithm>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int map[100][100];
int n, m;
int maxi;
void Search(int y, int x, int d)
{
maxi = max(maxi, d);
map[y][x] = 0;
// bool f = false;
for (int i = 0; i < 4; i++){
if (map[y + dy[i]][x + dx[i]]){
Search(y + dy[i], x + dx[i], d + 1);
// f = true;
}
}
map[y][x] = 1;
}
int main()
{
while (scanf("%d %d", &m, &n), m + n){
memset(map, 0, sizeof(map));
maxi = 0;
for (int i = 1; i <= n; i++){
for (int j = 1; j <= m; j++){
scanf("%d", &map[i][j]);
}
}
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++){
if (map[i][j]){
Search(i, j, 1);
}
}
}
printf("%d\n", maxi);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:33:17: error: 'memset' was not declared in this scope
33 | memset(map, 0, sizeof(map));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 | using namespace std;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.