Submission #123175

#TimeUsernameProblemLanguageResultExecution timeMemory
123175Mahdi_JfriArt Class (IOI13_artclass)C++14
73 / 100
158 ms13020 KiB
//#include "grader.h" #include "artclass.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ld long double const int maxn = 5e2 + 20; const int dx[] = {0 , 0 , -1 , 1}; const int dy[] = {1 ,-1 , 0 , 0}; ll t2(int x) { return (1LL * x * x); } ll t3(int x) { return abs(1LL * x * x * x); } int style(int n , int m , int R[500][500] , int G[500][500] , int B[500][500]) { vector<ll> tmp; ld mG = 0 , mR = 0 , mB = 0; for(int x = 0; x < n; x++) for(int y = 0; y < m; y++) { mG += t3(255 - G[x][y]) + t3(R[x][y]) + t3(B[x][y]); mR += t3(255 - R[x][y]) + t3(G[x][y]) + t3(B[x][y]); mB += t3(255 - B[x][y]) + t3(R[x][y]) + t3(G[x][y]); for(int i = 0; i < 4; i++) { int nx = x + dx[i] , ny = y + dy[i]; if(0 <= nx && nx < n && 0 <= ny && ny < m) { ll val = t2(R[x][y] - R[nx][ny]) + t2(G[x][y] - G[nx][ny]) + t2(B[x][y] - B[nx][ny]); tmp.pb(val); } } } mG /= n * m; mB /= n * m; mR /= n * m; sort(tmp.begin() , tmp.end()); reverse(tmp.begin() , tmp.end()); tmp.erase(tmp.begin() , tmp.begin() + n * m); int sz = tmp.size(); ld sum1 = tmp[sz / 2]; if(sum1 <= 1000 && mG <= 9e6) return 2; if(sum1 >= 200) return 3; if(min(mB , min(mG , mR)) <= 9e6) return 4; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...