QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#318154#3558. Constellation 3toj100 ✓214ms25516kbC++171.4kb2024-01-30 16:29:392024-01-30 16:29:39

Judging History

This is the latest submission verdict.

  • [2024-01-30 16:29:39]
  • Judged
  • Verdict: 100
  • Time: 214ms
  • Memory: 25516kb
  • [2024-01-30 16:29:39]
  • Submitted

answer

// S2OJ Submission #1179 @ 1706603378706
#include <bits/stdc++.h>
using namespace std;

struct dsu {
	vector<int> next;
	dsu(int n) : next(n + 2) {
		for (int i = 0; i <= n + 1; i++)
			next[i] = i; 
	}
	int find(int x) {
		return next[x] == x ? x : next[x] = find(next[x]);
	}
};

struct fenwick {
	vector<long long> a;
	fenwick(int n) : a(n + 1) {
	}
	long long sum(int i) {
		long long ans = 0;
		while (i > 0)
			ans += a[i], i -= i & -i;
		return ans;
	}
	void add(int i, long long x) {
		while (i < a.size()) {
			a[i] += x;
			i += i & -i;
		}
	}
};
int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int n;
	cin >> n;
	vector<vector<int>> z(n + 1);
	for (int i = 1; i <= n; i++) {
		int a;
		cin >> a;
		z[a].push_back(i);
	}
	int m;
	cin >> m;
	vector<vector<pair<int,int>>> star(n + 1);
	for (int i = 0; i < m; i++) {
		int x, y, c;
		cin >> x >> y >> c;
		star[y].push_back({x, c});
	}
	fenwick cost(n);
	dsu L(n), R(n);
	long long ans = 0;
	for (int y = 1; y <= n; y++) {
		for (auto s : star[y]) {
			int x = s.first, c = s.second;
			long long C = cost.sum(x);
			if (c <= C) ans += c;
			else {
				ans += C;
				int l = L.find(x), r = R.find(x);
				cost.add(l + 1, c - C);
				cost.add(r, C - c);
			} 
		}
		for  (int x : z[y]) {
			L.next[x] = x - 1;
			R.next[x] = x + 1; 
		}
	}
	cout << ans << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 14
Accepted

Test #1:

score: 14
Accepted
time: 1ms
memory: 3604kb

input:

297
296 275 40 154 200 77 201 106 133 163 127 268 225 154 27 202 272 176 133 116 151 11 262 281 188 152 249 53 133 106 160 62 104 210 54 201 184 110 199 217 155 193 168 239 277 22 230 187 201 14 85 100 159 129 69 241 150 10 20 263 285 76 219 52 40 241 126 182 23 55 243 145 203 163 251 243 13 292 249...

output:

4354552

result:

ok single line: '4354552'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

285
243 196 230 42 278 255 93 14 131 30 113 79 6 15 231 98 99 171 144 65 218 73 128 214 120 53 3 272 52 279 243 171 74 179 62 130 22 69 226 283 276 82 79 50 228 114 72 150 266 200 150 118 8 181 182 211 211 199 100 96 149 35 47 93 226 257 25 230 170 110 265 19 191 241 181 120 87 132 76 5 16 175 235 2...

output:

127882114793

result:

ok single line: '127882114793'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

292
49 242 118 101 2 259 88 201 149 208 49 288 58 228 263 273 171 169 19 280 92 251 84 208 217 275 242 200 289 73 213 201 143 199 283 111 197 142 17 264 39 10 271 98 35 218 9 91 241 214 33 138 131 212 280 91 166 163 63 44 287 33 150 47 171 111 55 182 145 42 39 223 238 172 104 73 227 225 74 39 81 9 2...

output:

79503140658

result:

ok single line: '79503140658'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3692kb

input:

282
277 189 224 50 43 193 219 31 98 124 218 193 49 4 25 236 55 268 248 32 82 153 204 192 223 175 132 64 39 196 164 112 156 210 224 49 205 266 107 200 270 106 70 150 142 115 276 10 87 169 179 50 197 108 174 261 108 126 177 228 128 203 216 107 81 186 30 30 233 211 217 275 125 96 259 165 141 126 231 28...

output:

5509144

result:

ok single line: '5509144'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

271
226 207 255 252 217 227 2 74 35 88 29 51 250 140 147 236 47 191 58 193 83 180 96 216 267 203 166 58 242 121 188 129 106 86 194 169 70 38 222 46 126 178 249 61 5 171 71 184 219 197 90 100 195 106 110 74 47 122 219 234 199 220 225 6 98 46 128 32 202 57 70 200 92 203 68 37 267 139 67 95 121 113 133...

output:

132525756438

result:

ok single line: '132525756438'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

272
196 207 179 73 26 7 148 104 52 244 249 92 195 242 57 190 201 15 86 143 194 219 21 152 35 3 78 114 240 245 243 19 74 139 110 223 115 62 44 82 102 260 151 214 212 54 83 71 81 185 54 71 178 39 13 128 202 257 135 30 206 53 208 238 270 120 197 194 196 39 193 260 53 58 154 51 53 253 185 75 101 154 236...

output:

74231338053

result:

ok single line: '74231338053'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

272
143 51 9 254 32 227 217 254 103 122 149 118 39 85 18 19 137 239 88 45 219 225 39 234 155 65 161 44 72 267 12 268 106 272 92 174 208 2 40 207 133 40 179 54 247 217 263 25 25 125 96 120 172 69 146 17 163 91 163 58 138 258 193 212 58 99 258 59 108 131 171 71 67 62 144 174 190 164 36 40 201 236 65 1...

output:

4624699

result:

ok single line: '4624699'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

291
142 39 268 141 80 107 121 246 146 13 86 287 184 181 31 209 33 248 53 152 154 124 9 284 7 69 30 114 71 29 109 13 26 52 5 245 62 59 123 208 150 208 144 19 235 223 81 253 47 185 200 227 31 261 188 30 35 26 90 130 41 99 283 33 131 260 76 190 217 178 15 271 279 213 168 18 106 31 69 249 113 109 175 20...

output:

135345251620

result:

ok single line: '135345251620'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

292
167 33 228 238 177 159 16 229 151 100 205 221 234 37 143 113 135 159 8 172 183 115 31 231 257 108 157 187 255 164 85 30 110 202 228 126 74 71 101 93 142 261 3 79 175 58 204 162 111 56 258 171 238 48 222 38 43 26 65 104 139 58 1 7 198 264 192 148 84 39 279 267 191 214 30 2 275 156 199 209 40 261 ...

output:

73747621317

result:

ok single line: '73747621317'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

299
298 299 292 294 293 280 279 277 278 273 275 272 268 269 265 267 259 256 257 252 254 251 253 249 250 239 227 229 223 225 222 219 218 213 215 211 210 206 203 205 200 202 196 193 190 187 189 188 183 182 180 181 173 172 170 171 169 166 165 163 155 157 145 147 143 130 132 126 123 118 115 117 116 111 ...

output:

7126205

result:

ok single line: '7126205'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

298
297 298 294 296 293 289 290 283 286 281 279 282 278 280 275 273 277 276 272 268 274 255 254 259 248 251 245 247 236 238 240 239 233 235 231 219 221 225 215 218 220 214 217 211 213 207 205 201 199 196 200 197 198 192 193 195 186 182 183 178 180 181 179 158 161 150 154 144 142 138 143 136 135 139 ...

output:

178779028252

result:

ok single line: '178779028252'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

297
291 293 295 277 281 285 274 273 280 267 270 271 261 259 265 258 260 255 252 257 243 246 247 251 245 242 240 248 244 236 238 237 241 229 225 209 217 211 202 200 204 203 197 188 186 191 194 185 178 183 190 175 177 174 172 166 164 169 167 162 160 163 158 161 151 149 143 154 146 136 132 134 135 128 ...

output:

7546225

result:

ok single line: '7546225'

Test #13:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

276
265 258 260 267 269 263 257 261 256 266 254 262 229 233 237 240 221 224 220 230 223 226 216 218 217 222 214 211 215 199 198 192 191 195 177 175 181 179 183 180 172 166 170 176 171 164 167 173 159 162 151 155 160 154 139 141 145 135 137 142 131 134 120 123 126 121 116 118 124 115 119 108 112 122 ...

output:

185805680138

result:

ok single line: '185805680138'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

280
271 271 280 271 271 271 271 271 261 261 261 251 251 251 261 261 251 241 251 261 241 241 241 241 251 231 241 231 231 241 221 221 221 231 231 221 211 211 221 201 211 211 191 191 191 181 191 181 181 191 191 171 171 171 171 181 171 171 161 161 161 151 151 151 151 161 151 141 151 141 141 151 151 141 ...

output:

6669786

result:

ok single line: '6669786'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

289
261 271 261 271 261 251 251 251 261 261 231 241 231 241 221 221 211 211 231 231 211 201 201 191 191 201 201 191 201 201 191 191 201 201 191 191 181 181 171 161 161 161 161 171 171 151 141 151 151 151 151 151 141 131 141 141 141 141 111 121 121 111 131 121 111 121 111 111 111 101 91 101 101 91 10...

output:

173984708133

result:

ok single line: '173984708133'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

300
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

output:

225325

result:

ok single line: '225325'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

276
276 275 271 271 270 272 273 271 270 269 270 272 271 270 273 272 267 268 267 268 269 270 267 265 265 266 268 266 267 265 264 263 266 267 266 267 268 269 270 271 270 271 270 269 270 271 272 274 272 269 268 268 270 267 268 269 267 266 266 267 268 268 267 267 268 266 263 262 262 263 264 265 265 266 ...

output:

7184505

result:

ok single line: '7184505'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

286
284 285 286 285 283 282 280 276 275 274 273 271 269 268 267 267 264 261 258 257 259 258 257 256 256 255 254 253 253 251 252 250 249 250 248 242 243 244 245 243 240 239 237 237 236 234 235 234 233 232 231 228 225 224 220 219 217 216 214 213 213 212 211 209 208 207 206 204 203 205 205 202 200 199 ...

output:

16149414

result:

ok single line: '16149414'

Test #19:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

276
273 274 272 268 267 267 269 267 268 270 268 269 269 268 265 266 267 266 266 267 266 267 268 267 268 267 266 267 268 268 268 269 267 267 268 268 268 269 270 269 267 268 268 269 270 269 269 270 271 270 271 271 271 272 273 271 272 273 273 271 268 269 269 267 268 270 270 272 271 270 269 268 270 271 ...

output:

4641330

result:

ok single line: '4641330'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

273
269 268 266 264 265 267 266 265 263 262 264 265 263 264 263 266 267 267 266 266 265 264 265 265 266 267 268 267 266 267 268 269 266 265 265 267 267 266 268 270 270 268 265 260 261 262 260 261 261 262 263 264 262 262 263 262 261 260 262 261 263 264 262 263 266 262 262 263 263 262 262 264 264 265 ...

output:

5625271

result:

ok single line: '5625271'

Test #21:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

284
284 282 281 282 280 280 278 277 275 274 272 269 268 266 264 263 262 264 263 262 260 260 259 257 254 253 253 252 251 251 248 247 246 240 241 242 242 241 240 238 236 235 233 234 233 231 231 230 230 229 227 228 226 227 226 223 224 223 222 218 215 213 212 212 207 208 208 205 206 205 202 201 200 198 ...

output:

21206626

result:

ok single line: '21206626'

Test #22:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

292
291 289 288 286 287 288 287 288 288 287 289 290 289 290 292 288 287 286 281 280 280 281 282 281 282 282 282 283 281 279 279 278 279 280 280 282 283 281 282 282 281 280 281 282 282 283 282 282 282 281 280 282 283 284 285 284 282 281 280 280 280 280 281 282 281 283 279 280 281 282 282 283 283 281 ...

output:

11350464

result:

ok single line: '11350464'

Subtask #2:

score: 21
Accepted

Dependency #1:

100%
Accepted

Test #23:

score: 21
Accepted
time: 0ms
memory: 3816kb

input:

1901
794 454 1464 448 1477 879 349 589 77 756 126 1412 444 1582 987 738 555 1714 487 930 485 1553 1728 319 1870 1131 1794 101 1600 1628 285 863 309 1074 1659 1687 608 337 711 1484 459 671 931 483 1556 1143 1270 825 192 1120 66 326 603 862 1472 490 274 612 662 425 166 1433 554 1541 838 1314 1129 1452...

output:

231823440

result:

ok single line: '231823440'

Test #24:

score: 0
Accepted
time: 2ms
memory: 3824kb

input:

1909
412 101 1610 928 445 694 152 1641 471 142 121 1428 9 1066 955 1747 1693 1014 31 897 690 996 1408 1777 79 603 407 1050 1885 828 794 93 177 1141 513 592 1129 626 995 1388 507 1711 1853 1736 1549 1163 465 150 1124 1164 1825 1813 1138 1714 1527 648 1860 439 604 1253 1438 806 143 516 146 1351 1295 1...

output:

923096593723

result:

ok single line: '923096593723'

Test #25:

score: 0
Accepted
time: 2ms
memory: 4020kb

input:

1905
965 477 185 1209 1445 1195 1169 1788 1045 769 872 299 1279 1015 1116 1757 1424 209 297 1850 1743 1018 1014 1146 1465 408 1436 908 1874 59 44 1861 1833 248 1103 1018 736 956 329 826 1013 1820 1593 599 1188 857 108 576 265 201 939 1844 483 845 476 74 1580 1888 446 1080 657 1871 988 1534 893 1525 ...

output:

545831526942

result:

ok single line: '545831526942'

Test #26:

score: 0
Accepted
time: 2ms
memory: 4060kb

input:

1973
1706 143 727 1964 1371 1241 195 1494 1125 1610 737 841 654 1581 1068 488 1315 608 507 1703 1450 977 1149 1295 1710 1667 256 896 1419 1421 61 1468 1790 431 835 683 1612 1311 979 1098 630 699 560 750 737 1112 701 1281 791 1008 954 380 434 637 1969 1632 971 1014 1476 1330 503 217 1271 322 1739 159...

output:

252929532

result:

ok single line: '252929532'

Test #27:

score: 0
Accepted
time: 2ms
memory: 3792kb

input:

1920
751 735 809 609 889 1307 343 825 1287 825 1506 1868 550 1623 486 1154 894 101 968 1382 1781 593 1505 371 1170 549 829 1199 1654 957 1040 589 486 781 317 1443 292 1021 17 1223 591 922 959 77 594 1474 1252 1109 1373 17 144 206 526 1779 879 243 825 930 769 1580 1661 668 95 113 353 747 850 871 370 ...

output:

900459850621

result:

ok single line: '900459850621'

Test #28:

score: 0
Accepted
time: 2ms
memory: 3812kb

input:

1900
849 1333 85 906 154 44 715 131 1015 89 6 1685 1126 1661 1631 1776 689 731 1696 1026 263 370 326 898 642 1624 1645 994 1023 1376 1250 117 1133 1854 114 338 1576 1243 897 1241 975 745 1032 1724 652 1165 495 1465 948 1188 1497 1792 1451 545 33 773 44 3 1565 1733 1723 977 1208 1253 1435 930 1238 11...

output:

554219838007

result:

ok single line: '554219838007'

Test #29:

score: 0
Accepted
time: 2ms
memory: 3832kb

input:

1942
643 983 242 657 358 539 721 1192 1048 1874 1852 371 308 318 1555 520 1249 1419 46 882 693 178 1156 910 699 479 1069 1584 127 643 1171 1187 215 222 494 577 1637 220 538 692 807 1783 1900 909 615 814 1552 894 1794 1391 1055 679 1763 1802 429 1595 204 353 1214 96 151 1014 1278 225 1091 1747 1317 6...

output:

224561053

result:

ok single line: '224561053'

Test #30:

score: 0
Accepted
time: 2ms
memory: 3772kb

input:

1994
29 1883 459 1154 1994 884 1875 721 888 488 500 1989 330 242 877 1341 1413 103 328 1114 954 1204 1826 1552 1790 31 1450 1042 1360 759 1924 934 1525 1085 1317 1638 466 937 595 272 707 858 1778 1103 1040 702 1058 1895 1129 195 421 1806 1098 996 995 1804 295 1883 64 1197 664 1635 580 653 536 468 77...

output:

893059905125

result:

ok single line: '893059905125'

Test #31:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

1921
1039 1383 899 1590 190 533 538 1184 1374 1063 421 23 63 1180 679 1808 346 1256 584 649 173 1282 1503 982 1254 658 1217 1872 730 81 1028 357 1900 1357 609 1799 626 681 213 220 1912 1795 426 1127 1254 779 509 917 1232 222 1500 141 143 1622 876 1216 415 1465 402 1058 1814 1347 1377 1474 1784 50 46...

output:

538950713596

result:

ok single line: '538950713596'

Test #32:

score: 0
Accepted
time: 2ms
memory: 3812kb

input:

1930
1928 1927 1922 1924 1920 1919 1917 1909 1903 1905 1899 1895 1897 1893 1894 1885 1886 1883 1884 1882 1879 1880 1874 1876 1870 1871 1867 1869 1868 1866 1864 1859 1860 1857 1854 1855 1852 1850 1851 1849 1846 1848 1845 1847 1844 1843 1839 1840 1835 1836 1834 1831 1830 1829 1828 1825 1827 1823 1826 ...

output:

350794558

result:

ok single line: '350794558'

Test #33:

score: 0
Accepted
time: 2ms
memory: 3856kb

input:

1999
1993 1989 1994 1990 1992 1985 1987 1986 1973 1977 1970 1972 1968 1966 1971 1964 1967 1956 1960 1952 1954 1957 1955 1950 1953 1940 1944 1928 1931 1927 1929 1925 1919 1920 1914 1916 1912 1908 1910 1902 1899 1905 1901 1903 1898 1900 1890 1894 1895 1891 1885 1888 1879 1882 1880 1874 1869 1871 1866 ...

output:

1390698601556

result:

ok single line: '1390698601556'

Test #34:

score: 0
Accepted
time: 2ms
memory: 3736kb

input:

1956
1953 1954 1950 1946 1949 1952 1951 1944 1947 1937 1934 1939 1936 1938 1931 1932 1935 1926 1929 1925 1933 1923 1924 1915 1918 1908 1901 1904 1911 1907 1897 1902 1910 1899 1894 1900 1896 1898 1895 1889 1892 1886 1884 1888 1874 1876 1867 1870 1861 1858 1856 1866 1859 1852 1855 1857 1847 1840 1843 ...

output:

352410473

result:

ok single line: '352410473'

Test #35:

score: 0
Accepted
time: 2ms
memory: 3780kb

input:

1984
1983 1980 1975 1984 1958 1955 1965 1961 1966 1945 1944 1949 1943 1937 1940 1935 1946 1928 1930 1926 1933 1939 1915 1912 1922 1917 1927 1914 1916 1913 1920 1904 1907 1898 1902 1911 1899 1905 1909 1901 1895 1896 1900 1892 1893 1882 1880 1885 1876 1871 1877 1870 1864 1868 1865 1874 1862 1867 1854 ...

output:

1403753069997

result:

ok single line: '1403753069997'

Test #36:

score: 0
Accepted
time: 2ms
memory: 3804kb

input:

1989
1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 ...

output:

388574983

result:

ok single line: '388574983'

Test #37:

score: 0
Accepted
time: 2ms
memory: 3696kb

input:

2000
1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 1801 ...

output:

1451428942950

result:

ok single line: '1451428942950'

Test #38:

score: 0
Accepted
time: 2ms
memory: 3844kb

input:

2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

1504598

result:

ok single line: '1504598'

Test #39:

score: 0
Accepted
time: 2ms
memory: 3768kb

input:

1974
1974 1970 1969 1963 1962 1956 1957 1956 1958 1957 1959 1958 1956 1957 1955 1956 1956 1957 1958 1959 1960 1960 1958 1957 1956 1956 1957 1958 1956 1956 1957 1959 1959 1957 1954 1955 1956 1957 1958 1956 1955 1956 1955 1957 1957 1958 1961 1959 1957 1958 1957 1957 1958 1960 1958 1956 1955 1954 1954 ...

output:

150550868

result:

ok single line: '150550868'

Test #40:

score: 0
Accepted
time: 2ms
memory: 3808kb

input:

1912
1909 1906 1905 1904 1903 1903 1901 1901 1900 1897 1896 1895 1892 1892 1888 1888 1885 1883 1881 1882 1881 1878 1875 1873 1874 1875 1872 1873 1871 1870 1871 1869 1867 1867 1866 1865 1857 1858 1854 1855 1853 1852 1849 1844 1845 1846 1846 1845 1843 1841 1841 1840 1839 1838 1837 1838 1836 1834 1832 ...

output:

901385647

result:

ok single line: '901385647'

Test #41:

score: 0
Accepted
time: 2ms
memory: 3836kb

input:

1963
1962 1957 1957 1957 1958 1957 1956 1957 1958 1957 1958 1959 1957 1956 1958 1954 1955 1956 1956 1957 1957 1958 1957 1958 1957 1957 1956 1956 1957 1958 1956 1956 1957 1956 1960 1959 1957 1958 1958 1956 1955 1955 1953 1952 1954 1955 1954 1955 1955 1955 1956 1957 1958 1956 1955 1953 1953 1952 1951 ...

output:

129743313

result:

ok single line: '129743313'

Test #42:

score: 0
Accepted
time: 2ms
memory: 3732kb

input:

1984
1980 1979 1975 1973 1974 1975 1974 1976 1977 1972 1971 1971 1973 1974 1975 1976 1973 1972 1972 1973 1974 1974 1975 1978 1977 1978 1976 1974 1975 1973 1972 1971 1974 1973 1974 1973 1972 1971 1971 1972 1973 1975 1973 1973 1974 1972 1973 1974 1974 1975 1976 1975 1977 1973 1971 1972 1973 1972 1972 ...

output:

150834752

result:

ok single line: '150834752'

Test #43:

score: 0
Accepted
time: 2ms
memory: 3744kb

input:

1908
1907 1906 1906 1905 1904 1903 1901 1901 1900 1898 1897 1896 1898 1897 1894 1893 1895 1895 1893 1892 1892 1890 1889 1891 1890 1888 1885 1883 1884 1884 1882 1881 1880 1880 1879 1878 1876 1874 1873 1874 1873 1871 1870 1867 1864 1863 1864 1862 1863 1857 1856 1857 1855 1853 1852 1847 1846 1847 1845 ...

output:

989415872

result:

ok single line: '989415872'

Test #44:

score: 0
Accepted
time: 2ms
memory: 3664kb

input:

1946
1945 1944 1942 1940 1938 1938 1939 1938 1939 1940 1938 1937 1936 1935 1938 1939 1938 1939 1939 1940 1939 1941 1940 1939 1938 1939 1939 1938 1937 1939 1937 1938 1937 1940 1940 1939 1938 1939 1938 1939 1939 1940 1940 1939 1940 1940 1940 1939 1938 1941 1940 1941 1940 1938 1937 1939 1937 1937 1938 ...

output:

76536867

result:

ok single line: '76536867'

Subtask #3:

score: 65
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #45:

score: 65
Accepted
time: 207ms
memory: 23172kb

input:

198543
40937 64321 111070 131291 103904 173129 93524 119960 65213 25842 39244 190494 149825 150211 191335 142472 134454 122034 116747 163381 164421 53850 136343 165568 169778 77365 194117 197571 37830 3376 90458 131368 179685 176089 108400 72396 89673 137444 82047 34431 37171 61321 14686 41736 12639...

output:

2433422974778

result:

ok single line: '2433422974778'

Test #46:

score: 0
Accepted
time: 211ms
memory: 22908kb

input:

196523
145208 125209 140141 109502 160855 46801 51077 70733 15410 85769 76145 138776 80019 104648 74898 173426 24579 104126 60680 119584 76490 12216 84695 2747 45412 138799 55717 92066 163484 46499 166336 174773 2312 126079 31896 81205 14629 86246 24416 183772 65098 114500 133064 28031 86341 154080 ...

output:

86292593702112

result:

ok single line: '86292593702112'

Test #47:

score: 0
Accepted
time: 212ms
memory: 22812kb

input:

192588
87395 50268 22226 157478 112877 16107 135894 49236 12961 52079 187365 155313 172639 67453 134810 1179 104327 89321 9780 39198 35789 127622 104600 75739 112551 114453 162425 155846 165091 157355 180261 44737 83490 39192 39195 173080 178858 96536 99750 145055 154278 161017 149874 154806 71698 1...

output:

55960257754315

result:

ok single line: '55960257754315'

Test #48:

score: 0
Accepted
time: 201ms
memory: 23280kb

input:

199429
168172 198087 43948 182632 169220 131950 93831 20233 132483 12904 47961 92074 121083 100454 56447 127567 184522 182840 151672 132978 97604 140888 77050 38463 94340 148037 28355 81177 6100 189019 15883 119755 179249 63891 95461 43614 116797 15362 95201 32092 54574 194641 107056 61688 151696 31...

output:

2271340660057

result:

ok single line: '2271340660057'

Test #49:

score: 0
Accepted
time: 214ms
memory: 22628kb

input:

191635
113065 115301 19654 115619 97469 10972 112103 155924 107472 11155 156550 122275 188691 132418 144969 78476 34178 127466 112222 112928 91123 26619 43356 135461 35282 54033 128486 72994 130552 29992 52923 58820 89258 94495 82065 151235 48527 172262 110755 3181 156482 158048 125994 121838 84662 ...

output:

88340065011844

result:

ok single line: '88340065011844'

Test #50:

score: 0
Accepted
time: 212ms
memory: 22532kb

input:

192193
150094 84172 77560 116531 15322 186402 77851 6460 116325 16059 163979 103117 163728 60717 85523 48681 23209 107776 15200 15512 156653 58894 188649 188607 74055 136658 125305 128408 189133 150693 146012 10015 15137 140716 121291 84110 40694 94329 154269 28505 92722 12998 181858 109353 183069 8...

output:

52446397117353

result:

ok single line: '52446397117353'

Test #51:

score: 0
Accepted
time: 210ms
memory: 22576kb

input:

192318
139489 154226 148099 119558 102237 19102 60265 175132 163413 9870 141031 24533 140307 15309 101113 47436 3382 28785 36335 51294 46546 104308 92044 87565 13234 187714 191994 91006 14281 49236 103426 42116 101406 33094 59013 143025 12622 187065 68189 145494 100539 30287 90566 20888 93358 82886 ...

output:

2434008604762

result:

ok single line: '2434008604762'

Test #52:

score: 0
Accepted
time: 214ms
memory: 23124kb

input:

196451
96933 27165 168350 76723 156965 53124 31161 23076 72102 110252 166843 57889 9130 33910 78401 152028 2926 55040 104904 167014 133451 165637 105921 47094 65295 3181 190926 195157 115140 167420 31383 130952 24898 119791 37301 118973 190435 79833 121054 182812 61020 71893 180640 95743 59543 13811...

output:

90313245860808

result:

ok single line: '90313245860808'

Test #53:

score: 0
Accepted
time: 213ms
memory: 23036kb

input:

196942
30860 162543 90497 734 187324 138068 91353 132000 87018 24449 68283 130844 34987 126232 28687 115795 67475 131551 167796 173035 184550 61428 138313 136640 96020 164288 187529 193710 88000 90011 130866 152195 68624 155032 41004 39874 181464 127963 128130 25569 195233 79058 22208 177631 46422 1...

output:

52569517721365

result:

ok single line: '52569517721365'

Test #54:

score: 0
Accepted
time: 188ms
memory: 25516kb

input:

198885
198884 198881 198883 198882 198872 198875 198866 198863 198862 198860 198861 198859 198856 198858 198854 198857 198852 198855 198850 198846 198848 198844 198847 198845 198840 198842 198835 198837 198834 198836 198832 198833 198829 198831 198827 198830 198825 198828 198823 198826 198820 198822...

output:

3902873263704

result:

ok single line: '3902873263704'

Test #55:

score: 0
Accepted
time: 186ms
memory: 25096kb

input:

193704
193702 193704 193700 193701 193699 193692 193695 193696 193689 193690 193693 193686 193683 193688 193675 193670 193672 193674 193671 193673 193667 193669 193668 193665 193666 193658 193655 193660 193654 193651 193656 193645 193640 193642 193634 193636 193639 193632 193627 193635 193624 193625...

output:

147516566543094

result:

ok single line: '147516566543094'

Test #56:

score: 0
Accepted
time: 187ms
memory: 24948kb

input:

192286
192285 192275 192268 192264 192267 192263 192256 192261 192265 192260 192257 192262 192255 192242 192245 192239 192241 192238 192243 192231 192230 192234 192232 192225 192227 192219 192217 192223 192226 192215 192207 192209 192202 192205 192206 192200 192197 192196 192203 192199 192201 192193...

output:

3820906513195

result:

ok single line: '3820906513195'

Test #57:

score: 0
Accepted
time: 185ms
memory: 24536kb

input:

190121
190120 190114 190118 190121 190119 190113 190108 190110 190116 190117 190104 190101 190111 190107 190112 190103 190105 190109 190102 190106 190094 190081 190086 190078 190075 190080 190071 190073 190072 190077 190063 190065 190069 190070 190066 190068 190061 190064 190054 190056 190060 190058...

output:

146822977916618

result:

ok single line: '146822977916618'

Test #58:

score: 0
Accepted
time: 175ms
memory: 20048kb

input:

192001
191801 191801 191801 191801 192001 191801 191801 191801 191801 191801 192001 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801 191801...

output:

3682908154955

result:

ok single line: '3682908154955'

Test #59:

score: 0
Accepted
time: 183ms
memory: 19700kb

input:

190529
190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401 190401...

output:

144700906036578

result:

ok single line: '144700906036578'

Test #60:

score: 0
Accepted
time: 142ms
memory: 25260kb

input:

200000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

150500687

result:

ok single line: '150500687'

Test #61:

score: 0
Accepted
time: 148ms
memory: 18960kb

input:

199560
199559 199550 199548 199543 199542 199542 199543 199542 199544 199542 199543 199541 199542 199541 199543 199542 199544 199545 199545 199546 199543 199544 199543 199545 199542 199541 199540 199540 199541 199543 199542 199540 199539 199538 199541 199539 199540 199541 199543 199542 199542 199544...

output:

315460566267

result:

ok single line: '315460566267'

Test #62:

score: 0
Accepted
time: 194ms
memory: 22592kb

input:

191500
191499 191500 191499 191498 191497 191496 191495 191494 191495 191494 191492 191491 191489 191486 191485 191484 191482 191480 191476 191477 191476 191474 191471 191470 191468 191466 191467 191467 191465 191466 191464 191464 191463 191462 191461 191459 191455 191454 191456 191457 191458 191455...

output:

9589486177527

result:

ok single line: '9589486177527'

Test #63:

score: 0
Accepted
time: 152ms
memory: 18644kb

input:

196288
196279 196278 196277 196278 196280 196278 196277 196276 196276 196277 196279 196279 196281 196278 196276 196277 196279 196279 196279 196280 196280 196275 196276 196274 196275 196275 196276 196275 196277 196275 196274 196273 196276 196275 196276 196275 196275 196276 196273 196274 196274 196275...

output:

308270858400

result:

ok single line: '308270858400'

Test #64:

score: 0
Accepted
time: 140ms
memory: 18292kb

input:

192353
192353 192350 192349 192347 192346 192343 192342 192341 192332 192331 192332 192331 192331 192333 192331 192332 192332 192333 192334 192333 192332 192330 192331 192329 192330 192329 192329 192328 192330 192330 192331 192333 192334 192335 192336 192335 192334 192333 192332 192332 192333 192334...

output:

334581512212

result:

ok single line: '334581512212'

Test #65:

score: 0
Accepted
time: 184ms
memory: 22764kb

input:

194429
194428 194427 194428 194425 194416 194417 194417 194416 194415 194414 194413 194411 194412 194413 194412 194405 194403 194402 194401 194401 194398 194397 194396 194395 194395 194394 194393 194392 194391 194390 194385 194383 194381 194380 194382 194383 194382 194381 194378 194379 194378 194377...

output:

9079247357468

result:

ok single line: '9079247357468'

Test #66:

score: 0
Accepted
time: 160ms
memory: 18020kb

input:

193546
193536 193535 193534 193533 193534 193533 193535 193534 193532 193531 193529 193528 193528 193529 193530 193529 193531 193531 193529 193530 193529 193530 193529 193532 193531 193532 193530 193531 193531 193532 193533 193532 193532 193531 193533 193532 193533 193532 193532 193529 193530 193527...

output:

934515559490

result:

ok single line: '934515559490'

Extra Test:

score: 0
Extra Test Passed