Submission #969232

#TimeUsernameProblemLanguageResultExecution timeMemory
969232anangoArt Class (IOI13_artclass)C++17
87 / 100
56 ms3924 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(R[nx][ny]-R[i][j]); bl+=abs(G[nx][ny]-G[i][j]); bl+=abs(B[nx][ny]-B[i][j]); } } } bl = bl/500/500; //cout << bl << endl; if (bl<38) { return 4; } if (bl<79) { return 1; } if (bl<193) { return 2; } return 3; }

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:11:9: warning: variable 'T' set but not used [-Wunused-but-set-variable]
   11 |     int T[500][500];
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...