제출 #235947

#제출 시각아이디문제언어결과실행 시간메모리
235947cfalas미술 수업 (IOI13_artclass)C++14
98 / 100
83 ms4092 KiB
#include<bits/stdc++.h> using namespace std; #include "artclass.h" typedef pair<int, int> ii; typedef pair<int, ii> iii; #define F first #define S second int getR(int RGB) { return (RGB >> 16) & 0xFF; } int getG(int RGB) { return (RGB >> 8) & 0xFF; } int getB(int RGB) { return RGB & 0xFF; } int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) { int blackcount=0; int wcount=0; int gcount=0; double stdb,stdr,stdg; double totb=0,totg=0,totr=0; double sfrr=0,sfgg=0,sfbb=0; double pix = h*w; double dev=0; double devv=0, dcnt=0; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if(r[i][j]+b[i][j]+g[i][j]<=25) blackcount++; else if(r[i][j]+b[i][j]+g[i][j]>=675) wcount++; if(g[i][j]>=100 && r[i][j]+b[i][j]<=150) gcount++; totb+=b[i][j]; sfbb+=b[i][j]*b[i][j]; totr+=r[i][j]; sfrr+=r[i][j]*r[i][j]; if(i!=0) dev+=abs(r[i][j]-r[i-1][j]), dcnt++, devv+=(r[i][j]-r[i-1][j])*(r[i][j]-r[i-1][j]); if(j!=0) dev+=abs(r[i][j]-r[i][j-1]), dcnt++, devv+=(r[i][j]-r[i][j-1])*(r[i][j]-r[i][j-1]); if(i!=h-1) dev+=abs(r[i][j]-r[i+1][j]), dcnt++, devv+=(r[i][j]-r[i+1][j])*(r[i][j]-r[i+1][j]); if(j!=w-1) dev+=abs(r[i][j]-r[i][j+1]), dcnt++, devv+=(r[i][j]-r[i][j+1])*(r[i][j]-r[i][j+1]); } } stdb = sqrt(sfbb/pix - (totb/pix)*(totb/pix)); stdr = sqrt(sfrr/pix - (totr/pix)*(totr/pix)); double devstd = sqrt(devv/dcnt - (dev/dcnt)*(dev/dcnt)); //cout<<gcount/((double)h*w)<<endl; //if(wcount!=0) cout<<(double)blackcount/wcount<<endl; //cout<<devstd<<endl; if(devstd<6) return 4; if(devstd>23) return 3; if(gcount>0.024*h*w) return 2; if(wcount>0.03*((double)h*w) || blackcount>0.01*(h*w)) return 1;// ||(wcount!=0 && (double)blackcount/wcount<300)) return 1; if(devstd>18) return 3; return 2; } /* int main(){ int t; cin>>t; while(t--){ int n,m; cin>>n>>m; int r[500][500]; int g[500][500]; int b[500][500]; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ int a; cin>>a; r[i][j] = getR(a); g[i][j] = getG(a); b[i][j] = getB(a); } } cout<<style(n,m,r,g,b)<<endl; } } */

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

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:19:9: warning: variable 'stdb' set but not used [-Wunused-but-set-variable]
  double stdb,stdr,stdg;
         ^~~~
artclass.cpp:19:14: warning: variable 'stdr' set but not used [-Wunused-but-set-variable]
  double stdb,stdr,stdg;
              ^~~~
artclass.cpp:19:19: warning: unused variable 'stdg' [-Wunused-variable]
  double stdb,stdr,stdg;
                   ^~~~
artclass.cpp:20:16: warning: unused variable 'totg' [-Wunused-variable]
  double totb=0,totg=0,totr=0;
                ^~~~
artclass.cpp:21:16: warning: unused variable 'sfgg' [-Wunused-variable]
  double sfrr=0,sfgg=0,sfbb=0;
                ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...