Submission #15765

#TimeUsernameProblemLanguageResultExecution timeMemory
15765ainta미술 수업 (IOI13_artclass)C++98
8 / 100
127 ms6560 KiB
#include "artclass.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, tot = 0, val = 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){
                tot++;
                if(Diff(i,j,i+1,j) < bound)val++;
            }
            if(j+1 < W){
                tot++;
                if(Diff(i,j,i,j+1) < bound)val++;
            }
        }
    }
    if((double)val/tot < bound2){
        return 2;
    }
    else{
        return 1;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...