Submission #935129

#TimeUsernameProblemLanguageResultExecution timeMemory
935129antonArt Class (IOI13_artclass)C++17
12 / 100
63 ms6476 KiB
#include "artclass.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> const int rond = 20; struct pixel{ pixel(){ } int r, g, b; pixel(int a, int _b, int c){ r=a; g=_b; b=c; } void round_pixel(){ r =(r/rond)*rond; g =(r/rond)*rond; b =(r/rond)*rond; } string to_s(){ string res; res.push_back(r); res.push_back(g); res.push_back(b); return res; } }; pixel img[500][500]; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { double green_s= 0.; double total_s = 0.; unordered_map<string, int> m; for(int i = 0; i<H; i++){ for(int j = 0; j<W; j++){ img[i][j] = pixel(R[i][j], G[i][j], B[i][j]); if(G[i][j]>R[i][j] && G[i][j]>B[i][j]){ green_s++; } img[i][j].round_pixel(); m[img[i][j].to_s()]++; } } green_s/=H*W; vector<int> v; for(auto e: m){ v.push_back(e.second); } sort(v.begin(), v.end()); //cout<<v.size()<<endl; int mx=0; for(int i = 0; i<3; i++){ mx+= v[v.size()-1-i]; } double percentage = (double)(mx)/(double)(H*W); //cout<<percentage<<" "<<green_s<<endl; if(percentage>0.5){ return (rand()%2)*3 + 1; } else{ if(green_s>0.2){ return 2; } else{ return 3; } } /*ll s= 0.; for(int j = 0; j<W; j++){ for(int i = 0; i<H-1; i++){ s+=(R[j][i+1]-R[j][i])*(R[j][i+1]-R[j][i]) + (G[j][i+1]-G[j][i])*(G[j][i+1]-G[j][i]) + (B[j][i+1]-B[j][i])*(B[j][i+1]-B[j][i]); } } double avg = (double)(s)/((double)((H-1)*W)); cout<<avg<<endl;*/ return 1; }

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:37:16: warning: unused variable 'total_s' [-Wunused-variable]
   37 |         double total_s = 0.;
      |                ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...