# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
123172 | Mahdi_Jfri | Art Class (IOI13_artclass) | C++14 | 268 ms | 28824 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#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 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> tmp1 , tmp2 , tmp3;
ld mG = 0 , mR = 0 , mB = 0;
for(int x = 0; x < n; x++)
for(int y = 0; y < m; y++)
{
mG += t2(255 - G[x][y]) + 10 * t2(R[x][y] + B[x][y]);
mR += t2(255 - R[x][y]) + 10 * t2(G[x][y] + B[x][y]);
mB += t2(255 - B[x][y]) + 10 * t2(R[x][y] + 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)
{
tmp1.pb(t2(R[x][y] - R[nx][ny]));
tmp2.pb(t2(G[x][y] - G[nx][ny]));
tmp3.pb(t2(B[x][y] - B[nx][ny]));
}
}
}
mG /= n * m;
mB /= n * m;
mR /= n * m;
sort(tmp1.begin() , tmp1.end());
sort(tmp2.begin() , tmp2.end());
sort(tmp3.begin() , tmp3.end());
reverse(tmp1.begin() , tmp1.end());
reverse(tmp2.begin() , tmp2.end());
reverse(tmp3.begin() , tmp3.end());
tmp1.erase(tmp1.begin() , tmp1.begin() + n * m);
tmp2.erase(tmp2.begin() , tmp2.begin() + n * m);
tmp3.erase(tmp3.begin() , tmp3.begin() + n * m);
ld sum1 = 0 , sum2 = 0 , sum3 = 0 , sz = tmp1.size();
for(int i = 0; i < (int)tmp1.size(); i++)
{
sum1 += tmp1[i];
sum2 += tmp2[i];
sum3 += tmp3[i];
}
sum1 += sum2 + sum3;
sz *= 3;
sum1 /= sz;
if(2000 <= sum1 && sum1 <= 1.5e4 && mG <= 2e8)
return 2;
if(sum1 >= 1e4)
return 3;
if(min(mB , min(mG , mR)) <= 2e8)
return 4;
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |