# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
753784 | minhcool | Art Class (IOI13_artclass) | C++17 | 0 ms | 0 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>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 3e5 + 5;
const int oo = 1e18 + 7, mod = 1e9 + 7;
mt19937 rng(1);
int rnd(int l, int r){
int temp = rng() % (r - l + 1);
return abs(temp) + l;
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]){
int cnt = 0;
for(int i = 0; i < H; i++){
for(int j = 0; j < W; j++){
if(i < H){
int sum = abs(R[i][j] - R[i + 1][j]) + abs(G[i][j] - G[i + 1][j]) + abs(B[i][j] - B[i + 1][j]);
if(sum <= 100) cnt++;
}
if(i < W){
int sum = abs(R[i][j] - R[i][j + 1]) + abs(G[i][j] - G[i][j + 1]) + abs(B[i][j] - B[i][j + 1]);
if(sum <= 100) cnt++;
}
}
}
if(cnt * 10 <= H * W) return 4;
else{
int cnt = 0;
for(int i = 0; i < H; i++){
for(int j = 0; j < W; j++){
if(G[i][j] == max(B[i][j], R[i][j], G[i][j])) cnt++;
}
}
if(cnt * 2 > H * W) return 2;
return (rnd(0, 1) ? 1 : 3);
}
}