제출 #15768

#제출 시각아이디문제언어결과실행 시간메모리
15768ainta미술 수업 (IOI13_artclass)C++98
93 / 100
131 ms6632 KiB
#include "artclass.h"
#include<stdio.h>
#include<algorithm>
#define bound 30
#define bound2 0.8
using namespace std;

int r[501][501], g[501][501], b[501][501];

int Diff(int x,int y,int x2, int y2){
    return abs(r[x][y]-r[x2][y2]) + abs(g[x][y]-g[x2][y2]) + abs(b[x][y]-b[x2][y2]);
}

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    int i, j, tot1 = 0, tot2 = 0, val1 = 0, val2 = 0;
    for(i=0;i<H;i++){
        for(j=0;j<W;j++){
            r[i][j] = R[i][j], g[i][j] = G[i][j], b[i][j] = B[i][j];
        }
    }
    for(i=0;i<H;i++){
        for(j=0;j<W;j++){
            if(i+1 < H){
                tot1++;
                if(Diff(i,j,i+1,j) < bound)val1++;
            }
            if(j+1 < W){
                tot2++;
                if(Diff(i,j,i,j+1) < bound)val2++;
            }
        }
    }
    double t = (double)(val1+val2)/(tot1+tot2);
    if(t > bound2){
        if(t > 0.97)return 4;
        return 1;
    }
    else{
        if(t < 0.45)return 3;
        else return 2;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...