Submission #8133

#TimeUsernameProblemLanguageResultExecution timeMemory
8133gs13073Art Class (IOI13_artclass)C++98
Compilation error
0 ms0 KiB
#include<stdio.h> #include<math.h> int H,W; double val[505][505]; double a,v,sq; int R[500][500], G[500][500], B[500][500]; int main() { int i,j,k,l; scanf("%d %d",&H,&W); for(i=0;i<H;i++)for(j=0;j<W;j++)scanf("%d",&R[i][j]); for(i=0;i<H;i++)for(j=0;j<W;j++)scanf("%d",&G[i][j]); for(i=0;i<H;i++)for(j=0;j<W;j++)scanf("%d",&B[i][j]); int A[8][2]={{1,1},{1,0},{1,-1},{-1,1},{-1,0},{-1,-1},{0,1},{0,-1}}; for(i=0;i<H;i++){ for(j=0;j<W;j++){ int cnt=0; double sum=0,tmp=0; int r=R[i][j]; int g=G[i][j]; int b=B[i][j]; for(k=0;k<8;k++){ i+=A[k][0]; j+=A[k][1]; if(i>=0 && i<H && j>=0 && j<W){ tmp=(R[i][j]-r)*(R[i][j]-r) +(G[i][j]-g)*(G[i][j]-g) +(B[i][j]-b)*(B[i][j]-b); tmp=sqrt(tmp); sum+=tmp; cnt++; } i-=A[k][0]; j-=A[k][1]; } val[i][j]=sum/cnt; a+=val[i][j]; sq+=(val[i][j]*val[i][j]); } } a/=(H*W); sq/=(H*W); double b=sq-a*a; if(a*b < 500 )printf("4"); else if(b>500 && a>30)printf("3"); else if(b/a > 15)printf("1"); else printf("2"); return 0; }

Compilation message (stderr)

artclass.cpp: In function 'int main()':
artclass.cpp:9:12: warning: unused variable 'l' [-Wunused-variable]
  int i,j,k,l;
            ^
artclass.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&H,&W);
  ~~~~~^~~~~~~~~~~~~~~
artclass.cpp:11:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<H;i++)for(j=0;j<W;j++)scanf("%d",&R[i][j]);
                                  ~~~~~^~~~~~~~~~~~~~~
artclass.cpp:12:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<H;i++)for(j=0;j<W;j++)scanf("%d",&G[i][j]);
                                  ~~~~~^~~~~~~~~~~~~~~
artclass.cpp:13:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<H;i++)for(j=0;j<W;j++)scanf("%d",&B[i][j]);
                                  ~~~~~^~~~~~~~~~~~~~~
/tmp/ccjpiUqG.o: In function `main':
artclass.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc4k2fOo.o:grader.c:(.text.startup+0x0): first defined here
/tmp/cc4k2fOo.o: In function `main':
grader.c:(.text.startup+0x202): undefined reference to `style'
collect2: error: ld returned 1 exit status