Submission #1201351

#TimeUsernameProblemLanguageResultExecution timeMemory
1201351kl0989eArt Class (IOI13_artclass)C++20
72 / 100
40 ms3408 KiB
#include <bits/stdc++.h> #include "artclass.h" using namespace std; #define ll long long #define fi first #define se second #define pb push_back #define vi vector<int> #define vl vector<ll> #define pi pair<int, int> #define pl pair<ll,ll> #define all(x) (x).begin(),(x).end() bool is_green(array<int,3> a) { return a[1]>=max(a[0],a[2])+3; } bool is_white(array<int,3> a) { return ((*min_element(all(a))>215) && ((max(max(a[0],a[1]),a[2])-min(min(a[0],a[1]),a[2]))<20)); } bool diff(array<int,3> a, array<int,3> b) { int d=0; for (int i=0; i<3; i++) { d+=abs(a[i]-b[i]); } return d>=12; } int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) { int green=0,white=0; int hor=0,ver=0; for (int i=0; i<h; i++) { for (int j=0; j<w; j++) { green+=is_green({r[i][j],g[i][j],b[i][j]}); white+=is_white({r[i][j],g[i][j],b[i][j]}); if (i!=h-1) { ver+=diff({r[i][j],g[i][j],b[i][j]},{r[i+1][j],g[i+1][j],b[i+1][j]}); } if (j!=w-1) { hor+=diff({r[i][j],g[i][j],b[i][j]},{r[i][j+1],g[i][j+1],b[i][j+1]}); } } } if (white>h*w/10) { return 1; } if (hor<h*w/3 && ver<h*w/2) { return 4; } if (green>h*w/5) { return 2; } return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...