Submission #681304

#TimeUsernameProblemLanguageResultExecution timeMemory
681304whqkrtk04Art Class (IOI13_artclass)C++17
82 / 100
58 ms3308 KiB
#include "artclass.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plll;
#define fi first
#define se second
const int INF = 1e9+1;
const int P = 1000000007;
const ll LLINF = (ll)1e18+1;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) { for(auto i : v) os << i << " "; os << "\n"; return os; }
template <typename T1, typename T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) { os << p.fi << " " << p.se; return os; }

double diffx(int arr[500][500], int i, int j) {
    if(!j) return 0;
    return abs(arr[i][j]-arr[i][j-1]);
}

double diffy(int arr[500][500], int i, int j) {
    if(!i) return 0;
    return abs(arr[i][j]-arr[i-1][j]);
}

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    double a = 0, b = 0, d = 0;
    int c = 0, x = 0, y = 0;
    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            double xx = diffx(R, i, j)+diffx(G, i, j)+diffx(B, i, j);
            double yy = diffy(R, i, j)+diffy(G, i, j)+diffy(B, i, j);
            a += xx/H/(W-1)/2;
            a += yy/(H-1)/W/2;
            if(xx < 10) x++;
            if(yy < 10) y++;
            d += xx/H/(W-1)/2;
            b += (double)G[i][j]/H/W;
            if(R[i][j] < 5 || G[i][j] < 5 || B[i][j] < 5
            || R[i][j] > 250 || G[i][j] > 250 || B[i][j] > 250) c++;
        }
    }
    //cout << a << " " << b << " " << c << " " << d << " " << a+5*d << "\n";
    if(a+5*d < 30 || a < 5 || d < 3) return 4;
    if(a+5*d > 200) return 3;
    if(a < 30 && b < 100) return 2;
    if(a > 50 || d > 30) return 3;
    if(c < 16000) return 2;
    return 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...