Submission #43828

#TimeUsernameProblemLanguageResultExecution timeMemory
43828PowerOfNinjaGoArt Class (IOI13_artclass)C++14
93 / 100
158 ms3680 KiB
//Power Of Ninja Go #include <bits/stdc++.h> #ifdef atom #include "gradertxt.c" #else #include "artclass.h" #endif using namespace std; typedef long long ll; typedef pair<int, int> ii; #define X first #define Y second #define vi vector<int> #define vii vector< ii > #define pb push_back int sq(int x){ return x*x;} int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { double res = 0; int n = H, m = W; double cntdiff = 0; for(int i = 0; i< n; i++) { for(int j = 0; j< m; j++) { int tmp = 0; double r = 0, g = 0, b = 0; for(int p = 0; p< 4; p++) { int ni = i+dx[p], nj = j+dy[p]; if(ni< 0 || ni>= n || nj< 0 || nj>= m) continue; r += R[ni][nj], g += G[ni][nj], b += B[ni][nj]; tmp++; } r /= tmp; g /= tmp; b/= tmp; double val = sqrt((sq(r-R[i][j])+sq(g-G[i][j])+sq(b-B[i][j]))/3); if(val> 50) cntdiff++; res += val; } } double tot = 0; for(int i = 0; i< n; i++) { for(int j = 0; j< m; j++) { tot += R[i][j] +G[i][j] + B[i][j]; } } res /= n*m; tot /= n*m; cntdiff /= n*m; if(res> 10) return 3; else if(res< 1.5) return 4; else if(tot>= 380) return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...