제출 #94193

#제출 시각아이디문제언어결과실행 시간메모리
94193fjzzq2002미술 수업 (IOI13_artclass)C++14
51 / 100
263 ms9356 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; typedef double ld; struct pnt { int x,y,z; }; pnt operator + (pnt a,pnt b) {return pnt{a.x+b.x,a.y+b.y,a.z+b.z};} ld sqr(ld x) {return x*x;} ld dis(pnt a,pnt b) {return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y)+sqr(a.z-b.z));} pnt u[500][500],p[100][100],t[23333]; int tn=0; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { for(int i=0;i<H;++i) for(int j=0;j<W;++j) u[i][j]=pnt{R[i][j],G[i][j],B[i][j]}; int HH=H/5,WW=W/5; tn=0; for(int i=0;i<HH;++i) for(int j=0;j<WW;++j) { for(int x=0;x<5;++x) for(int y=0;y<5;++y) p[i][j]=p[i][j]+u[i*5+x][j*5+y]; p[i][j].x/=25, p[i][j].y/=25, p[i][j].z/=25; } ld V0,V1,V2,V3,V4,V5,V6,V7,V8; { int s0=0; ld s1=0; for(int i=0;i<HH;++i) for(int j=0;j<WW;++j) s1+=p[i][j].x,++s0; V0=s1/s0; //S2: <=120 } { int s0=0; ld s1=0; for(int i=0;i<HH;++i) for(int j=0;j+1<WW;++j) ++s0,s1+=dis(u[i][j],u[i][j+1]); for(int i=0;i+1<HH;++i) for(int j=0;j<WW;++j) ++s0,s1+=dis(u[i][j],u[i+1][j]); V1=s1/s0; } { int cn=0; pnt g{0,0,0}; for(int i=0;i<HH;++i) for(int j=0;j<WW;++j) g=g+p[i][j],++cn; g.x/=cn,g.y/=cn,g.z/=cn; int s0=0; ld s1=0; for(int i=0;i<HH;++i) for(int j=0;j<WW;++j) s1+=dis(p[i][j],g),++s0; V2=s1/s0; } { int s0=0; ld s1=0; for(int i=0;i<HH;++i) for(int j=0;j<WW;++j) { for(int x=0;x<5;++x) for(int y=0;y<5;++y) s1+=dis(u[i*5+x][j*5+y],p[i][j]),++s0; } V3=s1/s0; } for(int i=0;i<HH;++i) for(int j=0;j<WW;++j) if(rand()%3) t[++tn]=u[i][j]; { int s0=0; ld s1=0; for(int i=1;i<=tn;++i) for(int j=i+1;j<=tn;++j) s1+=dis(t[i],t[j]),++s0; V4=s1/s0; } { int s0=0; ld s1=0; for(int i=1;i<=tn;++i) for(int j=i+1;j<=tn;++j) s1+=dis(t[i],t[j])<=10,++s0; V5=s1/s0; } { int s0=0; ld s1=0; for(int i=0;i<HH;++i) for(int j=0;j<WW;++j) for(int k=j+1;k<WW&&k<=j+5;++k) s1+=sqr(dis(u[i][j],u[i][k])),++s0; V6=s1/s0; } { int s0=0; ld s1=0; for(int i=0;i<WW;++i) for(int j=0;j<HH;++j) for(int k=j+1;k<HH&&k<=j+5;++k) s1+=sqr(dis(u[j][i],u[k][i])),++s0; V7=s1/s0; } { int s0=0; ld s1=0; for(int i=0;i<HH;++i) for(int j=0;j<WW;++j) for(int t=i;t<=i+4&&t<HH;++t) for(int r=j;r<=j+4&&r<=HH;++r) ++s0,s1+=pow(dis(u[i][j],u[t][r]),3); V8=s1/s0; //S3: >=1e6 (sure), S4: <=2e5 (not sure) } if(V8>=1e6) return 3; if(V0<=140&&V8<=2e5) return 2+rand()%2*2; if(V0<=140) return 2; if(V8<=2e5) return 4; return 1; // cerr<<V0<<","; cerr<<V8<<","; cerr.flush(); // cout<<V1<<" "<<V2<<" "<<V3<<" "<<V4<<" "<<V5<<"\n"; return 2; } //not accurate at all...

컴파일 시 표준 에러 (stderr) 메시지

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:30:8: warning: variable 'V1' set but not used [-Wunused-but-set-variable]
  ld V0,V1,V2,V3,V4,V5,V6,V7,V8;
        ^~
artclass.cpp:30:11: warning: variable 'V2' set but not used [-Wunused-but-set-variable]
  ld V0,V1,V2,V3,V4,V5,V6,V7,V8;
           ^~
artclass.cpp:30:14: warning: variable 'V3' set but not used [-Wunused-but-set-variable]
  ld V0,V1,V2,V3,V4,V5,V6,V7,V8;
              ^~
artclass.cpp:30:17: warning: variable 'V4' set but not used [-Wunused-but-set-variable]
  ld V0,V1,V2,V3,V4,V5,V6,V7,V8;
                 ^~
artclass.cpp:30:20: warning: variable 'V5' set but not used [-Wunused-but-set-variable]
  ld V0,V1,V2,V3,V4,V5,V6,V7,V8;
                    ^~
artclass.cpp:30:23: warning: variable 'V6' set but not used [-Wunused-but-set-variable]
  ld V0,V1,V2,V3,V4,V5,V6,V7,V8;
                       ^~
artclass.cpp:30:26: warning: variable 'V7' set but not used [-Wunused-but-set-variable]
  ld V0,V1,V2,V3,V4,V5,V6,V7,V8;
                          ^~
#Verdict Execution timeMemoryGrader output
Fetching results...