| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 250050 | MarcoMeijer | 미술 수업 (IOI13_artclass) | C++14 | 115 ms | 16120 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][3];
int dx[]={-1,0,1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,1,-1,-1};
double mult[]={2,2,2,2,1,1,1,1};
int h, w;
bool inside(int x, int y) {return x>=0 && x<h && y>=0 && y<w;}
double examples[4][27] = {{
86.8804,
55.4539,
47.2444,
27.4334,
19.5586,
38.1164,
24.2448,
32.4171,
46.568,
56.8275,
61.6161,
56.2133,
44.0842,
45.2076,
41.4799,
10.9688,
33.1464,
69.3415,
63.8643,
55.7544,
73.649,
7.22159,
36.1657,
58.316,
17.3317,
42.6255,
40.9485,
},
{
16.3541,
19.9271,
36.0986,
13.2304,
12.0493,
18.9068,
32.7128,
13.1758,
15.0642,
20,
17.2817,
14.6399,
19.986,
20.1402,
12.9125,
10.5127,
6.95448,
10.7322,
23.3665,
24.4908,
27.8487,
3.57144,
3.15323,
4.66665,
1.34382,
0.990829,
0.77384,
},
{
10.2524,
6.48575,
5.53414,
25.2778,
18.6789,
24.0981,
17.0978,
17.5467,
19.7319,
19.9207,
18.7127,
17.1221,
18.4707,
15.6036,
12.7489,
11.9682,
12.4103,
10.9832,
27.7819,
20.0311,
12.8469,
18.3125,
13.9427,
6.88892,
4.67113,
3.05842,
1.94268,
},
{
6.03315,
0.514533,
1.53856,
6.90773,
3.47993,
0.900075,
6.00295,
8.50453,
3.04516,
2.9472,
34.2193,
49.1408,
28.119,
5.95752,
6.09292,
3.43875,
29.5631,
16.1868,
24.8666,
3.35744,
1.50529,
10.1493,
5.1648,
1.35999,
13.4199,
13.6272,
6.24027,
}};
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;
RE(x,h) RE(y,w) RE(z,3) {
cd[x][y][z] = 0;
RE(d,8) {
int nx=x+dx[d];
int ny=y+dy[d];
if(!inside(nx,ny)) continue;
double dif = (c[ny][nx][z] - c[x][y][z])*mult[d];
cd[x][y][z] += dif*dif;
}
}
double values[3];
RE(z,3) {
double tot=0;
RE(x,h) RE(y,w) tot+=cd[x][y][z]*cd[x][y][z];
tot /= double(h*w);
values[z] = tot;
}
int ans = 0;
double closest = INF;
RE(i,4) {
double avg[3];
RE(j,3) avg[j] = 0.0;
RE(j,9) RE(k,3) avg[k] += examples[i][j*3+k];
RE(j,3) avg[j] /= 9.0;
double dist = 0.0;
RE(k,3) dist += fabs(values[k]-avg[k]);
if(dist < closest) {
closest = dist;
ans = i;
}
}
return ans+1;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
