# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
250222 | MarcoMeijer | Art Class (IOI13_artclass) | C++14 | 118 ms | 15996 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 "artclass.h"
#include <bits/stdc++.h>
using namespace std;
//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e9
#define pb push_back
#define fi first
#define se second
#define sz size()
double c [500][500][3];
double cd[500][500];
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
double a[500*501];
int n;
int h, w;
bool inside(int x, int y) {return x>=0 && x<h && y>=0 && y<w;}
double examples[4][27] = {
{
0.0109091,
0.0101446,
0.00873835,
0.00404107,
0.0035249,
0.00386889,
0.00137936,
0.00172778,
0.00127104,
0.00413971,
0.00454715,
0.00356544,
0.00276376,
0.00318757,
0.00303517,
0.00408466,
0.00859786,
0.00917388,
0.0075755,
0.00677046,
0.00767154,
0.00268609,
0.00252675,
0.00264916,
0.00105555,
0.00104585,
0.000941731,
},
{
0.000425112,
0.000444652,
0.000403727,
0.000509711,
0.000481196,
0.000410672,
0.000512709,
0.000418732,
0.000355152,
0.000547344,
0.000475419,
0.000320393,
0.00519053,
0.0054722,
0.00323484,
0.000574589,
0.000530536,
0.000463696,
0.00120081,
0.00115452,
0.000849246,
0.0024225,
0.00237696,
0.00215271,
0.000208186,
0.000190738,
0.000182205,
},
{
0.0303555,
0.0291137,
0.027395,
0.0119731,
0.0126469,
0.0133068,
0.0491802,
0.0501553,
0.0493885,
0.0619374,
0.0620273,
0.0587131,
0.0455293,
0.0462599,
0.0392547,
0.0132375,
0.013939,
0.0132419,
0.0273751,
0.0254123,
0.0222078,
0.0114205,
0.0100922,
0.0079416,
0.00456434,
0.0044406,
0.00403113,
},
{
1.37101e-05,
3.66086e-07,
1.73918e-06,
8.96418e-05,
6.22858e-07,
9.96181e-07,
0.000163873,
0.000508505,
0.000559124,
1.99636e-06,
4.27872e-06,
2.59126e-05,
3.49674e-05,
5.02084e-06,
3.04242e-06,
2.36257e-06,
7.97881e-05,
0.000197153,
6.72675e-07,
3.4936e-07,
3.21684e-06,
4.05642e-05,
1.53764e-05,
5.38145e-06,
1.24607e-06,
1.72399e-06,
3.45459e-05,
}
};
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
h=H, w=W;
RE(i,h) RE(j,w) c[i][j][0] = (double)R[i][j]/255.0;
RE(i,h) RE(j,w) c[i][j][1] = (double)G[i][j]/255.0;
RE(i,h) RE(j,w) c[i][j][2] = (double)B[i][j]/255.0;
n=0;
RE(x,h) RE(y,w) {
cd[x][y] = 0;
RE(z,3) RE(d,4) {
int nx=x+dx[d];
int ny=y+dy[d];
if(!inside(nx,ny)) continue;
double dif = (c[nx][ny][z] - c[x][y][z]);
cd[x][y] += dif*dif;
}
a[n++] = cd[x][y];
}
double green=0.0;
RE(i,h) RE(j,w) {
double val = max(0.0,(c[i][j][1]*1.5 - c[i][j][0]-c[i][j][2]));
green += val*val;
}
green /= h*w;
sort(a, a+n);
if(a[n/2] > 0.007) {
// 2 || 3
if(green > 0.00013)
return 2;
return 3;
} else {
// 1 || 4
if(a[(n/10)*9] > 0.006)
return 1;
return 4;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |