# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1101156 | alexander707070 | 미술 수업 (IOI13_artclass) | C++14 | 62 ms | 25672 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "artclass.h"
using namespace std;
int n,m;
int RR[500][500],GG[500][500],BB[500][500],cnt;
bool vis[500][500];
bool iswhite(int r,int g,int b){
return r>=200 and g>=200 and b>=200;
}
int diff(int x,int y,int w,int z){
return abs(RR[x][y]-RR[w][z]) + abs(GG[x][y]-GG[w][z]) + abs(BB[x][y]-BB[w][z]);
}
void dfs(int x,int y){
vis[x][y]=true;
cnt++;
if(x>0 and !vis[x-1][y] and diff(x,y,x-1,y)<=30)dfs(x-1,y);
if(y>0 and !vis[x][y-1] and diff(x,y,x,y-1)<=30)dfs(x,y-1);
if(x<n-1 and !vis[x+1][y] and diff(x,y,x+1,y)<=30)dfs(x+1,y);
if(y<m-1 and !vis[x][y+1] and diff(x,y,x,y+1)<=30)dfs(x,y+1);
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
n=H; m=W;
for(int i=0;i<500;i++){
for(int f=0;f<500;f++){
RR[i][f]=R[i][f];
GG[i][f]=G[i][f];
BB[i][f]=B[i][f];
vis[i][f]=false;
}
}
int br=0,maxcnt=0;
long long dif=0;
for(int i=0;i<H;i++){
for(int f=0;f<W;f++){
if(iswhite(RR[i][f],GG[i][f],BB[i][f]))br++;
if(f<W-1)dif+=diff(i,f,i,f+1);
if(i<H-1)dif+=diff(i,f,i+1,f);
if(!vis[i][f]){
cnt=0; dfs(i,f);
maxcnt=max(maxcnt,cnt);
}
}
}
if(maxcnt<=5000 or dif>22000000)return 3;
if(dif<=4000000)return 4;
if(dif<=8000000 or br>=50000)return 1;
return 2;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |