# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1076247 | TheQuantiX | 미술 수업 (IOI13_artclass) | C++17 | 46 ms | 6236 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "artclass.h"
using namespace std;
using ll = long long;
float dist(float a, float b, float c, float a1, float b1, float c1) {
a /= 255;
b /= 255;
c /= 255;
a1 /= 255;
b1 /= 255;
c1 /= 255;
return (abs(a - a1) + abs(b - b1) + abs(c - c1)) / 3.;
}
float zones(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
vector< vector<bool> > vis(H, vector<bool> (W));
float ans = 0;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (vis[i][j]) {
continue;
}
ans++;
queue< pair<ll, ll> > q;
q.push({i, j});
vis[i][j] = 1;
while (!q.empty()) {
auto p = q.front();
q.pop();
if (p.first > 0 && !vis[p.first - 1][p.second] && dist(R[p.first][p.second], G[p.first][p.second], B[p.first][p.second], R[p.first - 1][p.second], G[p.first - 1][p.second], B[p.first - 1][p.second]) < 0.2) {
q.push({p.first - 1, p.second});
vis[p.first - 1][p.second] = 1;
}
if (p.second > 0 && !vis[p.first][p.second - 1] && dist(R[p.first][p.second], G[p.first][p.second], B[p.first][p.second], R[p.first][p.second - 1], G[p.first][p.second - 1], B[p.first][p.second - 1]) < 0.2) {
q.push({p.first, p.second - 1});
vis[p.first][p.second - 1] = 1;
}
if (p.first < H - 1 && !vis[p.first + 1][p.second] && dist(R[p.first][p.second], G[p.first][p.second], B[p.first][p.second], R[p.first + 1][p.second], G[p.first + 1][p.second], B[p.first + 1][p.second]) < 0.2) {
q.push({p.first + 1, p.second});
vis[p.first + 1][p.second] = 1;
}
if (p.second < W - 1 && !vis[p.first][p.second + 1] && dist(R[p.first][p.second], G[p.first][p.second], B[p.first][p.second], R[p.first][p.second + 1], G[p.first][p.second + 1], B[p.first][p.second + 1]) < 0.2) {
q.push({p.first, p.second + 1});
vis[p.first][p.second + 1] = 1;
}
}
}
}
ans /= (H / 100.);
ans /= (W / 100.);
return ans;
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
mt19937 gen(chrono::system_clock::now().time_since_epoch().count());
auto f1 = zones(H, W, R, G, B);
if (f1 < 0.5) {
return 4;
}
else if (f1 < 31) {
return 2;
}
else if (f1 < 150) {
return 1;
}
else {
return 3;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |