Submission #969229

#TimeUsernameProblemLanguageResultExecution timeMemory
969229anangoArt Class (IOI13_artclass)C++14
87 / 100
51 ms4432 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; bool bounds(int x, int y) { return (0<=x && x<500 && 0<=y && y<500); } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { double bl=0; int T[500][500]; vector<int> dx={0,0,-1,1}; vector<int> dy={1,-1,0,0}; for (int i=0; i<500; i++) { for (int j=0; j<500; j++) { T[i][j] = (R[i][j]+G[i][j]+B[i][j])/3; } } for (int i=0; i<500; i++) { for (int j=0; j<500; j++) { for (int d=0; d<4; d++) { int nx=i+dx[d]; int ny=j+dy[d]; if (!bounds(nx,ny)) { continue; } bl+=abs(T[nx][ny]-T[i][j]); } } } bl = bl/500/500; //cout << bl << endl; if (bl<11) { return 4; } if (bl<29) { return 1; } if (bl<50) { return 2; } return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...