# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
585020 | benson1029 | Art Class (IOI13_artclass) | C++14 | 81 ms | 19120 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "artclass.h"
#include <bits/stdc++.h>
using namespace std;
int h,w;
bool vis[500][500];
int v[500][500][3];
double avg[500][500][3];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
bool valid(int x, int y) {
return (x>=0&&y>=0&&x<h&&y<w);
}
bool near(int X1, int Y1, int X2, int Y2) {
return (abs(v[X1][Y1][0]-v[X2][Y2][0]) + abs(v[X1][Y1][1]-v[X2][Y2][1]) + abs(v[X1][Y1][2]-v[X2][Y2][2])) <= 20;
}
bool near2(int X1, int Y1, int X2, int Y2) {
return (abs(v[X1][Y1][0]-v[X2][Y2][0]) + abs(v[X1][Y1][1]-v[X2][Y2][1]) + abs(v[X1][Y1][2]-v[X2][Y2][2])) <= 10;
}
void dfs(int x, int y) {
vis[x][y] = true;
for(int i=0; i<4; i++) {
if(!valid(x+dx[i], y+dy[i])) continue;
if(vis[x+dx[i]][y+dy[i]]) continue;
if(near(x, y, x+dx[i], y+dy[i])) {
dfs(x+dx[i], y+dy[i]);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |