Submission #43826

#TimeUsernameProblemLanguageResultExecution timeMemory
43826PowerOfNinjaGoArt Class (IOI13_artclass)C++14
98 / 100
150 ms3652 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; 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; res += sq(r-R[i][j])+sq(g-G[i][j])+sq(b-B[i][j]); } } 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; if(res> 1000) return 3; else if(res< 26) return 4; else if(tot>= 380) return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...