# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
69862 | FLDutchman | Art Class (IOI13_artclass) | C++14 | 131 ms | 66560 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;
typedef int INT;
#define FOR(i,l,r) for(int i = (l); i < (r); i++)
#define fst first
#define snd second
#define pb push_back
#define mp make_pair
#define V vector
#define int long long
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
const int NMAX = 1e5+10;
double sqr(double x) {return x * x;}
struct color{
double r, g, b;
double l;
color (){}
color (int r, int g, int b) : r(r), g(g), b(b) {l = sqrt(r*r + g*g + b*b); l = l == 0 ? 1 : l;}
int operator- (const color &c) {
//cerr<<r/l<<endl;
return abs(l-c.l); //abs(r/l-c.r/c.l) + abs(g/l-c.g/c.l) + abs(b/l-c.b/c.l);
}
};
V<V<color>> canvas;
int H, W;
double diff(){
double tot = 0;
double div = 0;
FOR(i, 0, H) FOR(j, 0, W){
if(i > 0) {tot += canvas[i][j] - canvas[i-1][j]; div++;}
if(j > 0) {tot += canvas[i][j] - canvas[i][j-1]; div++;}
}
return tot / div;
}
INT style(INT h, INT w, INT R[500][500], INT G[500][500], INT B[500][500]) {
H=h; W=w;
canvas.assign(H, V<color>(W));
FOR(i, 0, H) FOR(j, 0, W){
canvas[i][j] = {R[i][j], G[i][j], B[i][j]};
}
int k = 10 * diff();
if(k <= 40) return 4;
if(k <= 115) return 1;
if(k <= 300) return 2;
return 3;
}
/*
signed main(){
cout << setprecision(3);
FOR(style, 1, 5) {
FOR(i, 1, 10) cout << (int) (10000*diff("style-"+to_string(style)+"-"+to_string(i)+".txt") ) << "\t";
cout << endl;
}
}*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |