#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF = 1e9+7;
ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ll,ii>
#define f(i,a,b) for(ll i = a;i < b;i++)
#define pb push_back
#define vll vector<ll>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst)
///Stay Calm
///Look for special cases
///Beware of overflow and array bounds
///Think the problem backwards
///Deltix Round, Spring 2021 (open for everyone, rated, Div. 1 + Div. 2)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<ll> distr;
ll rnd(ll a, ll b){return distr(rng)%(b-a+1)+a;}
#include "artclass.h"
/*
#ifndef __ARTCLASS_H__
#define __ARTCLASS_H__
#ifdef __cplusplus
extern "C" {
#endif
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]);
#ifdef __cplusplus
}
#endif
#endif
#include <stdio.h>
static int DIM[2];
static int R[500][500];
static int G[500][500];
static int B[500][500];
int main() {
FILE *in = fopen("artclass.txt", "r");
if(in == NULL) {
puts("Failed to open input file (artclass.txt).");
return 0;
}
if(fscanf(in, "%d%d", DIM, DIM+1) != 2) {
printf("Line 1: H, W must be integers\n");
return 0;
}
if(DIM[0] < 100 || 500 < DIM[0]) {
printf("Line 1: 100 <= H <= 500\n");
return 0;
}
if(DIM[1] < 100 || 500 < DIM[1]) {
printf("Line 1: 100 <= W <= 500\n");
return 0;
}
for(int i = 0; i< DIM[0]; i++) {
for(int j = 0; j < DIM[1]; j++) {
if(fscanf(in, "%d%d%d", &R[i][j], &G[i][j], &B[i][j]) != 3) {
printf("Line %d: R[i][j], G[i][j], B[i][j] must be integers", i*DIM[1]+j+2, i, j);
return 0;
}
if(R[i][j] < 0 || 255 < R[i][j]) {
printf("Line %d: 0 <= R[%d][%d] <= 255", i*DIM[1]+j+2, i, j);
return 0;
}
if(G[i][j] < 0 || 255 < G[i][j]) {
printf("Line %d: 0 <= G[%d][%d] <= 255", i*DIM[1]+j+2, i, j);
return 0;
}
if(B[i][j] < 0 || 255 < B[i][j]) {
printf("Line %d: 0 <= B[%d][%d] <= 255", i*DIM[1]+j+2, i, j);
return 0;
}
}
}
printf("%d\n", style(DIM[0], DIM[1], R, G, B));
return 0;
}
*/
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
ll n = H,m = W;
ll posa = (n * m + 3) / 4;
ll ans = 1;
f(i,0,n){
f(j,0,m){
ll maxi = max({abs(R[i][j] - G[i][j]),abs(R[i][j] - B[i][j]),abs(G[i][j] - B[i][j])});
if(maxi <= 30){
posa--;
}
}
}
if(posa <= 0){
ans = 2;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
135 ms |
4292 KB |
Output isn't correct |
2 |
Incorrect |
46 ms |
4348 KB |
Output isn't correct |
3 |
Correct |
47 ms |
3592 KB |
Output is correct |
4 |
Incorrect |
48 ms |
3640 KB |
Output isn't correct |
5 |
Incorrect |
85 ms |
4292 KB |
Output isn't correct |
6 |
Incorrect |
45 ms |
4272 KB |
Output isn't correct |
7 |
Incorrect |
81 ms |
4164 KB |
Output isn't correct |
8 |
Incorrect |
39 ms |
4372 KB |
Output isn't correct |
9 |
Incorrect |
50 ms |
3780 KB |
Output isn't correct |
10 |
Correct |
70 ms |
4160 KB |
Output is correct |
11 |
Incorrect |
35 ms |
2852 KB |
Output isn't correct |
12 |
Incorrect |
53 ms |
4372 KB |
Output isn't correct |
13 |
Incorrect |
45 ms |
3484 KB |
Output isn't correct |
14 |
Incorrect |
51 ms |
3816 KB |
Output isn't correct |
15 |
Incorrect |
14 ms |
1300 KB |
Output isn't correct |
16 |
Incorrect |
50 ms |
3652 KB |
Output isn't correct |
17 |
Incorrect |
201 ms |
3480 KB |
Output isn't correct |
18 |
Incorrect |
55 ms |
4368 KB |
Output isn't correct |
19 |
Correct |
75 ms |
4152 KB |
Output is correct |
20 |
Incorrect |
54 ms |
4292 KB |
Output isn't correct |
21 |
Incorrect |
57 ms |
3976 KB |
Output isn't correct |
22 |
Incorrect |
41 ms |
4288 KB |
Output isn't correct |
23 |
Incorrect |
41 ms |
4184 KB |
Output isn't correct |
24 |
Incorrect |
106 ms |
3808 KB |
Output isn't correct |
25 |
Incorrect |
75 ms |
3780 KB |
Output isn't correct |
26 |
Incorrect |
45 ms |
4292 KB |
Output isn't correct |
27 |
Incorrect |
31 ms |
2708 KB |
Output isn't correct |
28 |
Incorrect |
42 ms |
4308 KB |
Output isn't correct |
29 |
Correct |
46 ms |
3652 KB |
Output is correct |
30 |
Incorrect |
67 ms |
4040 KB |
Output isn't correct |
31 |
Incorrect |
39 ms |
3776 KB |
Output isn't correct |
32 |
Correct |
45 ms |
3468 KB |
Output is correct |
33 |
Correct |
86 ms |
3960 KB |
Output is correct |
34 |
Incorrect |
26 ms |
2464 KB |
Output isn't correct |
35 |
Incorrect |
70 ms |
4264 KB |
Output isn't correct |
36 |
Incorrect |
59 ms |
3780 KB |
Output isn't correct |
37 |
Incorrect |
41 ms |
4364 KB |
Output isn't correct |
38 |
Incorrect |
71 ms |
4276 KB |
Output isn't correct |
39 |
Incorrect |
69 ms |
3696 KB |
Output isn't correct |
40 |
Incorrect |
83 ms |
4036 KB |
Output isn't correct |
41 |
Incorrect |
69 ms |
3652 KB |
Output isn't correct |
42 |
Correct |
42 ms |
3176 KB |
Output is correct |
43 |
Incorrect |
61 ms |
4096 KB |
Output isn't correct |
44 |
Incorrect |
42 ms |
3252 KB |
Output isn't correct |
45 |
Incorrect |
48 ms |
3772 KB |
Output isn't correct |
46 |
Incorrect |
65 ms |
4280 KB |
Output isn't correct |
47 |
Incorrect |
50 ms |
4272 KB |
Output isn't correct |
48 |
Correct |
45 ms |
3524 KB |
Output is correct |
49 |
Incorrect |
58 ms |
3736 KB |
Output isn't correct |
50 |
Incorrect |
43 ms |
3140 KB |
Output isn't correct |
51 |
Incorrect |
48 ms |
4268 KB |
Output isn't correct |
52 |
Incorrect |
39 ms |
4164 KB |
Output isn't correct |
53 |
Incorrect |
37 ms |
4316 KB |
Output isn't correct |
54 |
Incorrect |
51 ms |
4356 KB |
Output isn't correct |
55 |
Incorrect |
46 ms |
3620 KB |
Output isn't correct |
56 |
Incorrect |
38 ms |
2532 KB |
Output isn't correct |
57 |
Correct |
54 ms |
3784 KB |
Output is correct |
58 |
Incorrect |
81 ms |
4032 KB |
Output isn't correct |
59 |
Incorrect |
57 ms |
4232 KB |
Output isn't correct |
60 |
Incorrect |
39 ms |
3160 KB |
Output isn't correct |
61 |
Incorrect |
57 ms |
4168 KB |
Output isn't correct |
62 |
Incorrect |
270 ms |
2968 KB |
Output isn't correct |
63 |
Incorrect |
69 ms |
4296 KB |
Output isn't correct |
64 |
Incorrect |
51 ms |
4192 KB |
Output isn't correct |
65 |
Incorrect |
52 ms |
4368 KB |
Output isn't correct |
66 |
Incorrect |
85 ms |
4164 KB |
Output isn't correct |
67 |
Incorrect |
55 ms |
4296 KB |
Output isn't correct |
68 |
Incorrect |
55 ms |
3616 KB |
Output isn't correct |
69 |
Incorrect |
77 ms |
3932 KB |
Output isn't correct |
70 |
Incorrect |
98 ms |
3788 KB |
Output isn't correct |
71 |
Incorrect |
56 ms |
4328 KB |
Output isn't correct |
72 |
Incorrect |
60 ms |
3800 KB |
Output isn't correct |
73 |
Incorrect |
50 ms |
4256 KB |
Output isn't correct |
74 |
Incorrect |
56 ms |
3696 KB |
Output isn't correct |
75 |
Correct |
68 ms |
3564 KB |
Output is correct |
76 |
Incorrect |
37 ms |
2464 KB |
Output isn't correct |
77 |
Correct |
56 ms |
3492 KB |
Output is correct |
78 |
Correct |
63 ms |
4212 KB |
Output is correct |
79 |
Incorrect |
74 ms |
3816 KB |
Output isn't correct |
80 |
Correct |
95 ms |
3656 KB |
Output is correct |
81 |
Incorrect |
21 ms |
3652 KB |
Output isn't correct |
82 |
Incorrect |
70 ms |
4148 KB |
Output isn't correct |
83 |
Incorrect |
46 ms |
3736 KB |
Output isn't correct |
84 |
Incorrect |
58 ms |
3908 KB |
Output isn't correct |
85 |
Incorrect |
75 ms |
4292 KB |
Output isn't correct |
86 |
Incorrect |
40 ms |
2496 KB |
Output isn't correct |
87 |
Incorrect |
48 ms |
4284 KB |
Output isn't correct |
88 |
Incorrect |
48 ms |
4304 KB |
Output isn't correct |
89 |
Incorrect |
45 ms |
3268 KB |
Output isn't correct |
90 |
Correct |
238 ms |
4152 KB |
Output is correct |
91 |
Incorrect |
54 ms |
3920 KB |
Output isn't correct |
92 |
Incorrect |
54 ms |
3736 KB |
Output isn't correct |
93 |
Incorrect |
264 ms |
4292 KB |
Output isn't correct |
94 |
Incorrect |
51 ms |
4300 KB |
Output isn't correct |
95 |
Incorrect |
58 ms |
4328 KB |
Output isn't correct |
96 |
Incorrect |
50 ms |
3704 KB |
Output isn't correct |
97 |
Incorrect |
56 ms |
4284 KB |
Output isn't correct |
98 |
Incorrect |
52 ms |
3556 KB |
Output isn't correct |
99 |
Incorrect |
48 ms |
4164 KB |
Output isn't correct |
100 |
Correct |
56 ms |
3840 KB |
Output is correct |
101 |
Incorrect |
34 ms |
2936 KB |
Output isn't correct |
102 |
Correct |
70 ms |
3556 KB |
Output is correct |