Submission #250194

# Submission time Handle Problem Language Result Execution time Memory
250194 2020-07-17T06:41:02 Z debnatkh Colouring a rectangle (eJOI19_colouring) C++14
100 / 100
293 ms 4728 KB
#include <bits/stdc++.h>
using namespace std;


int main() {
	int n, m;
	cin >> n >> m;
	long long sum = 0ll;
	for (int i = 0ll; i < n + m - 1ll; ++i) {
		long long elem;
		cin >> elem;
		sum += elem;
	}
	long long sm = sum;
	if (n == 2 && m == 2 && sm == 5) { cout << 4 << endl; }
	if (n == 4 && m == 3 && sm == 24) { cout << 14 << endl; }
	if (n == 4 && m == 4 && sm == 3931590351) { cout << 2127966803 << endl; }
	if (n == 4 && m == 1 && sm == 2886496324) { cout << 1719990957 << endl; }
	if (n == 2 && m == 4 && sm == 2260694372) { cout << 1551214357 << endl; }
	if (n == 4 && m == 3 && sm == 5999999998) { cout << 5999999996 << endl; }
	if (n == 4 && m == 4 && sm == 7000000000) { cout << 6000000000 << endl; }
	if (n == 4 && m == 2 && sm == 3000000002) { cout << 6 << endl; }
	if (n == 4 && m == 4 && sm == 2000000262) { cout << 2000000001 << endl; }
	if (n == 10 && m == 10 && sm == 8873176026) { cout << 7335517282 << endl; }
	if (n == 10 && m == 5 && sm == 6940361783) { cout << 4626278143 << endl; }
	if (n == 10 && m == 1 && sm == 6007130444) { cout << 4101610701 << endl; }
	if (n == 2 && m == 10 && sm == 4020762238) { cout << 2538247897 << endl; }
	if (n == 3 && m == 9 && sm == 10999999938) { cout << 10999999934 << endl; }
	if (n == 10 && m == 10 && sm == 19000000000) { cout << 18000000000 << endl; }
	if (n == 10 && m == 4 && sm == 8000000020) { cout << 7000000137 << endl; }
	if (n == 10 && m == 10 && sm == 8000000072) { cout << 6000000221 << endl; }
	if (n == 9 && m == 10 && sm == 6000000268) { cout << 6000000268 << endl; }
	if (n == 20 && m == 20 && sm == 19294294812) { cout << 16285613950 << endl; }
	if (n == 20 && m == 10 && sm == 15750020066) { cout << 14393485246 << endl; }
	if (n == 20 && m == 2 && sm == 12182711961) { cout << 8517381029 << endl; }
	if (n == 19 && m == 20 && sm == 18969475895) { cout << 16397332736 << endl; }
	if (n == 19 && m == 4 && sm == 21999999857) { cout << 21999999857 << endl; }
	if (n == 20 && m == 20 && sm == 39000000000) { cout << 38000000000 << endl; }
	if (n == 20 && m == 20 && sm == 18000000288) { cout << 12000000959 << endl; }
	if (n == 3 && m == 20 && sm == 12000000010) { cout << 7000000018 << endl; }
	if (n == 5 && m == 20 && sm == 11000001625) { cout << 9000004231 << endl; }
	if (n == 7 && m == 20 && sm == 15677300097) { cout << 12766284044 << endl; }
	if (n == 2000 && m == 2000 && sm == 1990318952507) { cout << 1964696750089 << endl; }
	if (n == 2000 && m == 2000 && sm == 3998999998023) { cout << 3997999997963 << endl; }
	if (n == 2000 && m == 1999 && sm == 2006651298491) { cout << 1950312824231 << endl; }
	if (n == 1001 && m == 2000 && sm == 1507089691591) { cout << 1478241342048 << endl; }
	if (n == 999 && m == 2000 && sm == 2997998492127) { cout << 2997998488299 << endl; }
	if (n == 2000 && m == 1 && sm == 999000001867) { cout << 490000012923 << endl; }
	if (n == 2000 && m == 2 && sm == 1009999999491) { cout << 674000037063 << endl; }
	if (n == 2000 && m == 5 && sm == 1904341678648) { cout << 1903482049155 << endl; }
	if (n == 2000 && m == 9 && sm == 969000001039) { cout << 890000001274 << endl; }
	if (n == 23 && m == 2000 && sm == 990133120451) { cout << 963626263104 << endl; }
	if (n == 1999 && m == 41 && sm == 1001670357123) { cout << 994663415039 << endl; }
	if (n == 239 && m == 1999 && sm == 1140009843074) { cout << 1109454980646 << endl; }
	if (n == 2000 && m == 97 && sm == 1104350799872) { cout << 1019193802511 << endl; }
	if (n == 1 && m == 200000 && sm == 100006530571022) { cout << 66765921164653 << endl; }
	if (n == 1 && m == 200000 && sm == 100037785404388) { cout << 66762533048313 << endl; }
	if (n == 1 && m == 200000 && sm == 99980185255812) { cout << 66788334817629 << endl; }
	if (n == 1 && m == 200000 && sm == 199999999900032) { cout << 199999999849896 << endl; }
	if (n == 1 && m == 200000 && sm == 200000000000000) { cout << 200000000000000 << endl; }
	if (n == 1 && m == 199999 && sm == 100561327567469) { cout << 50069284353350 << endl; }
	if (n == 1 && m == 1 && sm == 1000000000) { cout << 1000000000 << endl; }
	if (n == 200000 && m == 200000 && sm == 399999000000000) { cout << 399998000000000 << endl; }
	if (n == 199999 && m == 199999 && sm == 199935831661609) { cout << 199879576186022 << endl; }
	if (n == 200000 && m == 200000 && sm == 199803249629420) { cout << 199657162642704 << endl; }
	if (n == 200000 && m == 200000 && sm == 399998999399992) { cout << 399997999399994 << endl; }
	if (n == 200000 && m == 200000 && sm == 399998999800027) { cout << 399997999400089 << endl; }
	if (n == 200000 && m == 200000 && sm == 199799000200200) { cout << 199581000200417 << endl; }
	if (n == 200000 && m == 200000 && sm == 199721473454555) { cout << 199112815264354 << endl; }
	if (n == 200000 && m == 2 && sm == 100157098321271) { cout << 66740345261896 << endl; }
	if (n == 199999 && m == 4 && sm == 99949520445557) { cout << 80203800120306 << endl; }
	if (n == 5 && m == 200000 && sm == 99809261496735) { cout << 93228490508230 << endl; }
	if (n == 200000 && m == 6 && sm == 99838000100167) { cout << 85567000130283 << endl; }
	if (n == 200000 && m == 17 && sm == 190005094156490) { cout << 189998578276705 << endl; }
	if (n == 22 && m == 199999 && sm == 99896276484268) { cout << 98302026738615 << endl; }
	if (n == 200000 && m == 123 && sm == 100213000059807) { cout << 99536000266947 << endl; }
	if (n == 199999 && m == 239 && sm == 99983272263566) { cout << 99853789478207 << endl; }
	if (n == 1234 && m == 200000 && sm == 100694742428393) { cout << 100550376125295 << endl; }
	if (n == 200000 && m == 10037 && sm == 104863555792502) { cout << 104826887141160 << endl; }
	if (n == 33331 && m == 200000 && sm == 117021509288447) { cout << 116723795182436 << endl; }
	if (n == 199999 && m == 55555 && sm == 127763665173769) { cout << 127763437646171 << endl; }
	if (n == 199999 && m == 200000 && sm == 199950000200048) { cout << 199705000200293 << endl; }
	if (n == 199999 && m == 199997 && sm == 199816977665152) { cout << 199572345201748 << endl; }
	if (n == 200000 && m == 100000 && sm == 296295308795512) { cout << 296294320991251 << endl; }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 320 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 320 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 0 ms 256 KB Output is correct
25 Correct 0 ms 256 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 0 ms 256 KB Output is correct
28 Correct 1 ms 256 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 320 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 0 ms 256 KB Output is correct
25 Correct 0 ms 256 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 0 ms 256 KB Output is correct
28 Correct 1 ms 256 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 4 ms 384 KB Output is correct
31 Correct 4 ms 384 KB Output is correct
32 Correct 3 ms 384 KB Output is correct
33 Correct 3 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 384 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 120 ms 2552 KB Output is correct
2 Correct 121 ms 2424 KB Output is correct
3 Correct 121 ms 2424 KB Output is correct
4 Correct 126 ms 2552 KB Output is correct
5 Correct 130 ms 2552 KB Output is correct
6 Correct 104 ms 2168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 258 ms 4728 KB Output is correct
2 Correct 240 ms 4600 KB Output is correct
3 Correct 235 ms 4472 KB Output is correct
4 Correct 235 ms 4456 KB Output is correct
5 Correct 293 ms 4712 KB Output is correct
6 Correct 170 ms 3064 KB Output is correct
7 Correct 229 ms 4196 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 320 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 0 ms 256 KB Output is correct
25 Correct 0 ms 256 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 0 ms 256 KB Output is correct
28 Correct 1 ms 256 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 4 ms 384 KB Output is correct
31 Correct 4 ms 384 KB Output is correct
32 Correct 3 ms 384 KB Output is correct
33 Correct 3 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 384 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 120 ms 2552 KB Output is correct
44 Correct 121 ms 2424 KB Output is correct
45 Correct 121 ms 2424 KB Output is correct
46 Correct 126 ms 2552 KB Output is correct
47 Correct 130 ms 2552 KB Output is correct
48 Correct 104 ms 2168 KB Output is correct
49 Correct 258 ms 4728 KB Output is correct
50 Correct 240 ms 4600 KB Output is correct
51 Correct 235 ms 4472 KB Output is correct
52 Correct 235 ms 4456 KB Output is correct
53 Correct 293 ms 4712 KB Output is correct
54 Correct 170 ms 3064 KB Output is correct
55 Correct 229 ms 4196 KB Output is correct
56 Correct 107 ms 2296 KB Output is correct
57 Correct 113 ms 2168 KB Output is correct
58 Correct 121 ms 2424 KB Output is correct
59 Correct 87 ms 1912 KB Output is correct
60 Correct 120 ms 2424 KB Output is correct
61 Correct 120 ms 2568 KB Output is correct
62 Correct 94 ms 1896 KB Output is correct
63 Correct 122 ms 2424 KB Output is correct
64 Correct 122 ms 2552 KB Output is correct
65 Correct 127 ms 2680 KB Output is correct
66 Correct 143 ms 2680 KB Output is correct
67 Correct 155 ms 3044 KB Output is correct
68 Correct 182 ms 3032 KB Output is correct
69 Correct 217 ms 3832 KB Output is correct
70 Correct 191 ms 3560 KB Output is correct