제출 #355337

#제출 시각아이디문제언어결과실행 시간메모리
355337kylych03Art Class (IOI13_artclass)C++14
73 / 100
96 ms3348 KiB
#include "artclass.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
 
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) int((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define OK cout << "OK" << endl;
 
int n, m;
 
int style(int H, int W, int r[500][500], int g[500][500], int b[500][500]){
    n = H; m = W;
    int i, j, cnt = 0;
    ll diff = 0;
    for(i = 0; i < n; i++){
        for(j = 0; j < m-1; j++){
            diff += abs(r[i][j]-r[i][j+1])+abs(g[i][j]-g[i][j+1])+abs(b[i][j]-b[i][j+1]);
            cnt++;
        }
    }
    for(i = 0; i < n-1; i++){
        for(j = 0; j < m; j++){
            diff += abs(r[i][j]-r[i+1][j])+abs(g[i][j]-g[i+1][j])+abs(b[i+1][j]-b[i][j]);
            cnt++;
        }
    }
    
    diff /= cnt;
    if(diff <= 8) return 4;
    if(diff <= 30) return 1;
    
    cnt = 0;
    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            if(r[i][j] <= g[i][j] && b[i][j] <= g[i][j]) cnt++;
        }
    }
    if((double)cnt >= double(n*m)*0.4) return 2;
    return 3;
}
#Verdict Execution timeMemoryGrader output
Fetching results...