Submission #396398

# Submission time Handle Problem Language Result Execution time Memory
396398 2021-04-29T23:32:48 Z wmrmr Art Class (IOI13_artclass) C++17
3 / 100
99 ms 3284 KB
#include "artclass.h"
#include <bits/stdc++.h>
using namespace std;

int MOD(int x)
{
	if(x>0) return x;
	return -x;
}

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
	bool style4 = 1;
    for(int i=0;i<H;i++)
    {
    	int cnt,sR,sG,sB; cnt = sR = sG = sB = 0;
    	float w = W;
    	for(int j=0;j<W;j++)
    	{
    		sR += R[i][j];
    		sG += G[i][j];
    		sB += B[i][j];
		}
		int aR = sR/W, aG = sG/W, aB = sB/W;
		for(int j=0;j<W;j++)
		{
			if( MOD(R[i][j]-aR) <= 15 && MOD(G[i][j]-aG) <= 15 && MOD(B[i][j]-aB) <= 15 ) cnt++;
		}
		float ind = cnt;
		if(cnt < w*0.7) { style4 = 0; break; }
	}
	if(style4) return 4;
	int cntW = 0;
	for(int i=0;i<H;i++) for(int j=0;j<W;j++)
	{
		if(R[i][j] <= 15 && G[i][j] <= 15 && B[i][j] <= 15) cntW++;
	}
	if(cntW >= H*W/10) return 1;
	srand(time(0));
	return (rand()%2) ? 2 : 3;
}

Compilation message

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:28:9: warning: unused variable 'ind' [-Wunused-variable]
   28 |   float ind = cnt;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 2444 KB Output isn't correct
2 Incorrect 87 ms 3044 KB Output isn't correct
3 Incorrect 54 ms 2740 KB Output isn't correct
4 Correct 55 ms 2748 KB Output is correct
5 Incorrect 49 ms 3132 KB Output isn't correct
6 Incorrect 69 ms 3148 KB Output isn't correct
7 Correct 51 ms 3184 KB Output is correct
8 Incorrect 31 ms 1412 KB Output isn't correct
9 Correct 55 ms 3188 KB Output is correct
10 Incorrect 78 ms 3076 KB Output isn't correct
11 Incorrect 39 ms 3212 KB Output isn't correct
12 Correct 51 ms 2552 KB Output is correct
13 Incorrect 32 ms 3136 KB Output isn't correct
14 Incorrect 74 ms 3136 KB Output isn't correct
15 Incorrect 49 ms 2088 KB Output isn't correct
16 Incorrect 33 ms 1708 KB Output isn't correct
17 Incorrect 53 ms 3216 KB Output isn't correct
18 Incorrect 52 ms 2676 KB Output isn't correct
19 Incorrect 49 ms 3144 KB Output isn't correct
20 Correct 67 ms 3116 KB Output is correct
21 Correct 54 ms 2452 KB Output is correct
22 Incorrect 53 ms 3200 KB Output isn't correct
23 Incorrect 99 ms 3204 KB Output isn't correct
24 Incorrect 74 ms 3104 KB Output isn't correct
25 Incorrect 88 ms 3144 KB Output isn't correct
26 Incorrect 62 ms 3140 KB Output isn't correct
27 Incorrect 49 ms 3196 KB Output isn't correct
28 Correct 64 ms 2560 KB Output is correct
29 Correct 66 ms 3192 KB Output is correct
30 Correct 46 ms 3144 KB Output is correct
31 Incorrect 69 ms 3136 KB Output isn't correct
32 Incorrect 72 ms 2624 KB Output isn't correct
33 Incorrect 50 ms 3208 KB Output isn't correct
34 Incorrect 56 ms 2756 KB Output isn't correct
35 Incorrect 61 ms 3112 KB Output isn't correct
36 Incorrect 52 ms 2608 KB Output isn't correct
37 Incorrect 46 ms 3140 KB Output isn't correct
38 Incorrect 63 ms 3196 KB Output isn't correct
39 Incorrect 51 ms 3140 KB Output isn't correct
40 Correct 41 ms 2192 KB Output is correct
41 Correct 17 ms 3224 KB Output is correct
42 Correct 58 ms 3116 KB Output is correct
43 Incorrect 39 ms 3140 KB Output isn't correct
44 Correct 66 ms 3152 KB Output is correct
45 Correct 40 ms 2068 KB Output is correct
46 Incorrect 49 ms 2560 KB Output isn't correct
47 Incorrect 27 ms 1412 KB Output isn't correct
48 Incorrect 86 ms 3208 KB Output isn't correct
49 Incorrect 32 ms 1476 KB Output isn't correct
50 Correct 50 ms 2536 KB Output is correct
51 Incorrect 78 ms 3168 KB Output isn't correct
52 Incorrect 55 ms 2848 KB Output isn't correct
53 Correct 18 ms 844 KB Output is correct
54 Incorrect 69 ms 3092 KB Output isn't correct
55 Correct 55 ms 3140 KB Output is correct
56 Incorrect 52 ms 3172 KB Output isn't correct
57 Incorrect 52 ms 3196 KB Output isn't correct
58 Incorrect 45 ms 3144 KB Output isn't correct
59 Incorrect 33 ms 1780 KB Output isn't correct
60 Incorrect 78 ms 3172 KB Output isn't correct
61 Correct 48 ms 2520 KB Output is correct
62 Incorrect 62 ms 2532 KB Output isn't correct
63 Incorrect 78 ms 3100 KB Output isn't correct
64 Incorrect 59 ms 3120 KB Output isn't correct
65 Correct 57 ms 2720 KB Output is correct
66 Incorrect 59 ms 3184 KB Output isn't correct
67 Incorrect 41 ms 3284 KB Output isn't correct
68 Incorrect 45 ms 2148 KB Output isn't correct
69 Incorrect 54 ms 3108 KB Output isn't correct
70 Incorrect 52 ms 3208 KB Output isn't correct
71 Incorrect 41 ms 3204 KB Output isn't correct
72 Correct 51 ms 2572 KB Output is correct
73 Correct 71 ms 3144 KB Output is correct
74 Correct 39 ms 2032 KB Output is correct
75 Correct 55 ms 2600 KB Output is correct
76 Incorrect 64 ms 2804 KB Output isn't correct
77 Correct 54 ms 3216 KB Output is correct
78 Incorrect 63 ms 3152 KB Output isn't correct
79 Correct 54 ms 3140 KB Output is correct
80 Correct 36 ms 1864 KB Output is correct
81 Incorrect 46 ms 3100 KB Output isn't correct
82 Correct 50 ms 2588 KB Output is correct
83 Correct 59 ms 2468 KB Output is correct
84 Correct 52 ms 2688 KB Output is correct
85 Correct 54 ms 2736 KB Output is correct
86 Incorrect 52 ms 3188 KB Output isn't correct
87 Correct 62 ms 2484 KB Output is correct
88 Incorrect 65 ms 3128 KB Output isn't correct
89 Incorrect 32 ms 1728 KB Output isn't correct
90 Incorrect 65 ms 3144 KB Output isn't correct
91 Correct 51 ms 2672 KB Output is correct
92 Incorrect 57 ms 3172 KB Output isn't correct
93 Incorrect 72 ms 3112 KB Output isn't correct
94 Incorrect 49 ms 1696 KB Output isn't correct
95 Incorrect 53 ms 3188 KB Output isn't correct
96 Incorrect 65 ms 3220 KB Output isn't correct
97 Incorrect 53 ms 3280 KB Output isn't correct
98 Correct 56 ms 2428 KB Output is correct
99 Correct 52 ms 2376 KB Output is correct
100 Incorrect 56 ms 3144 KB Output isn't correct
101 Incorrect 74 ms 3196 KB Output isn't correct
102 Incorrect 53 ms 2484 KB Output isn't correct