Submission #383717

#TimeUsernameProblemLanguageResultExecution timeMemory
383717alireza_kavianiArt Class (IOI13_artclass)C++11
96 / 100
69 ms3436 KiB
#include <bits/stdc++.h> #include "artclass.h" using namespace std; int cntR[256] , cntG[256] , cntB[256]; int cntD[1000]; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { int r = 0 , g = 0 , b = 0; int mnr = 500 , mxr = 0 , mng = 500 , mxg = 0 , mnb = 500 , mxb = 0 , cnt = 0; for(int i = 0 ; i < H ; i++){ for(int j = 0 ; j < W ; j++){ r += R[i][j]; // cntR[R[i][j]]++; mnr = min(mnr , R[i][j]); mxr = max(mxr , R[i][j]); g += G[i][j]; // cntG[G[i][j]]++; mng = min(mng , G[i][j]); mxg = max(mxg , G[i][j]); b += B[i][j]; // cntB[B[i][j]]++; mnb = min(mnb , B[i][j]); mxb = max(mxb , B[i][j]); if(G[i][j] * 3 >= 2 * (R[i][j] + B[i][j])) cnt++; } } long long diff = 0 , diff2 = 0 , sum = 0; for(int i = 1 ; i < H ; i++){ for(int j = 0 ; j < W ; j++){ int dr = R[i][j] - R[i - 1][j] , dg = G[i][j] - G[i - 1][j] , db = B[i][j] - B[i - 1][j]; dr = abs(dr); dg = abs(dg); db = abs(db); diff += dr; diff += dg; diff += db; diff2 += dr * dr; diff2 += dg * dg; diff2 += db * db; cntR[abs(dr)]++; cntG[abs(dg)]++; cntB[abs(db)]++; cntD[min({dr , dg , db})]++; //sum += min({dr , dg , db}) * min({dr , dg , db}); } } for(int i = 70 ; i < 256 ; i++){ // cout << cntB[i] << ' '; // if(i % 16 == 15) cout << endl; sum += cntR[i] + cntG[i]; } /*for(int i = 60 ; i < 1000 ; i++){ cout << cntD[i] << ' '; if(i % 20 == 19) cout << endl; sum += cntD[i]; }*/ int rm = r / (H * W) , gm = g / (H * W) , bm = b / (H * W); int val = rm + gm + bm; partial_sum(cntR , cntR + 256 , cntR); partial_sum(cntG , cntG + 256 , cntG); partial_sum(cntB , cntB + 256 , cntB); // cout << rm << ' ' << gm << ' ' << bm << ' ' << val << ' ' << diff / (H * W) << endl; /* cout << mnr << ' ' << mxr << endl; cout << mng << ' ' << mxg << endl; cout << mnb << ' ' << mxb << endl; for(int i = 0 ; i < 256 ; i++){ if(cntR[i] * 2 >= H * W){ cout << i << ' '; break; } } for(int i = 0 ; i < 256 ; i++){ if(cntG[i] * 2 >= H * W){ cout << i << ' '; break; } } for(int i = 0 ; i < 256 ; i++){ if(cntB[i] * 2 >= H * W){ cout << i << endl; break; } }*/ diff /= (H * W); diff2 /= (H * W); cnt = 1ll * cnt * 1000000 / (H * W); sum = sum * 1000 / (H * W); // cout << cnt << ' ' << sum << endl; // cout << rm << ' ' << gm << ' ' << bm << ' ' << val << ' ' << diff << ' ' << diff2 << endl; if(diff <= 40){ if(diff <= 15 && bm <= 120) return 4; if(val >= 350) return 1; return 2; } if(sum <= 90) return 2; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...