# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
280095 | shayan_p | Art Class (IOI13_artclass) | C++14 | 85 ms | 6140 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.
// And you curse yourself for things you never done
#include<bits/stdc++.h>
#include "artclass.h"
#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double ld;
const int maxn = 1e5 + 10, mod = 1e9 + 7, inf = 1e9 + 10;
int style(int n, int m, int R[500][500], int G[500][500], int B[500][500]) {
ll sR = 0, sG = 0, sB = 0;
ll green = 0;
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++)
sR+= R[i][j], sG+= G[i][j], sB+= B[i][j];
double RR = double(sR) / n/m, GG = double(sG) / n/m, BB = double(sB) / n/m;
auto calc_borders = [&](int eps, int cnt){
int borders = 0;
auto same = [&](int x, int y, int xx, int yy){
return (abs(R[x][y] - R[xx][yy]) <= eps) + (abs(G[x][y] - G[xx][yy]) <= eps) + (abs(B[x][y] - B[xx][yy]) <= eps) >= cnt;
};
for(int i = 0; i < n; i++)
for(int j = 0; j < m-1; j++)
borders+= !same(i, j, i, j+1);
for(int i = 0; i < n-1; i++)
for(int j = 0; j < m; j++)
borders+= !same(i, j, i+1, j);
return double(borders)/n/m;
};
auto calc_borders2 = [&](int eps, int cnt){
int borders = 0;
auto same = [&](int x, int y, int xx, int yy){
return (abs(R[x][y] - R[xx][yy]) <= eps) + (abs(G[x][y] - G[xx][yy]) <= eps) + (abs(B[x][y] - B[xx][yy]) <= eps) <= cnt;
};
for(int i = 0; i < n; i++)
for(int j = 0; j < m-1; j++)
borders+= !same(i, j, i, j+1);
for(int i = 0; i < n-1; i++)
for(int j = 0; j < m; j++)
borders+= !same(i, j, i+1, j);
return double(borders)/n/m;
};
// cout << calc_borders(60, 3) << endl;
// cout << RR << " " << GG << " " << BB << endl;
if(calc_borders2(10, 2) <= 0.9)
return 3;
if(BB >= 100)
return 1;
if(calc_borders(70, 3) <= 0.003)
return 4;
return 2;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |