QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#457087#8121. Kuglicefryan#110 ✓32ms125740kbC++201.8kb2024-06-29 02:17:082024-06-29 02:17:09

Judging History

你现在查看的是最新测评结果

  • [2024-06-29 02:17:09]
  • 评测
  • 测评结果:110
  • 用时:32ms
  • 内存:125740kb
  • [2024-06-29 02:17:08]
  • 提交

answer

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define int long long
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()

const int inf = 1e18;
const int mxn = 3e3;

int n, a[mxn], foc[mxn], loc[mxn], nuq[mxn][mxn], dp[mxn][mxn];
set<int> rev;

signed main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	
	cin >> n;
	for (int i = 0; i < mxn; i++) {
		foc[i] = inf, loc[i] = -inf;
	}
	for (int i = 0; i < n; i++) {
		cin >> a[i]; --a[i];
		foc[a[i]] = min(foc[a[i]], i);
		loc[a[i]] = max(loc[a[i]], i);
		rev.insert(a[i]);
	}
	nuq[0][n-1] = sz(rev);
	for (int l = 0; l < n; l++) {
		for (int r = n-1; r > l; r--) {
			//case 1 - remove left endpoint
			int v = a[l];
			if (foc[v] == l && loc[v] <= r) {
				nuq[l+1][r] = nuq[l][r]-1;
			} else {
				nuq[l+1][r] = nuq[l][r];
			}
			//case 2 - remove right endpoint
			v = a[r];
			if (foc[v] >= l && loc[v] == r) {
				nuq[l][r-1] = nuq[l][r]-1;
			} else {
				nuq[l][r-1] = nuq[l][r];
			}
		}
	}
	
	for (int l = n-1; l >= 0; l--) {
		for (int r = l; r < n; r++) {
			int lv = a[l], rv = a[r];
			if (l == r && foc[lv] == l && loc[lv] == r) {
				dp[l][r] = 1;
				continue;
			}
			//case 1 - take left
			int gl = nuq[l][r] - dp[l+1][r];
			//case 2 - take right
			int gr = nuq[l][r] - dp[l][r-1];
			
			dp[l][r] = max(gl,gr);
		}
	}
	
	cout << dp[0][n-1] << ":" << nuq[0][n-1] - dp[0][n-1];
	
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 17
Accepted

Test #1:

score: 17
Accepted
time: 1ms
memory: 5704kb

input:

1
1

output:

1:0

result:

ok single line: '1:0'

Test #2:

score: 0
Accepted
time: 19ms
memory: 121204kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1:0

result:

ok single line: '1:0'

Test #3:

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

input:

10
2 1 1 2 2 2 1 2 2 2

output:

1:1

result:

ok single line: '1:1'

Test #4:

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

input:

2
1 1

output:

1:0

result:

ok single line: '1:0'

Test #5:

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

input:

22
2 2 1 2 2 2 2 2 1 1 1 1 2 1 1 2 2 1 1 1 1 2

output:

2:0

result:

ok single line: '2:0'

Test #6:

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

input:

500
1 1 1 2 1 2 2 1 2 2 2 1 2 1 1 1 1 2 2 1 1 1 1 2 1 1 2 2 1 2 2 1 2 1 1 1 2 2 1 1 1 2 1 2 2 1 1 1 1 2 1 1 2 1 2 2 1 2 2 1 1 1 2 1 1 2 1 1 1 1 1 2 2 2 1 1 2 1 1 2 1 1 2 2 2 2 2 2 1 1 1 1 1 2 1 2 1 1 2 1 1 2 2 2 1 1 1 1 1 1 2 1 2 2 1 1 1 2 2 1 2 2 1 2 1 2 1 1 2 2 2 1 2 1 2 2 1 2 2 2 1 2 2 2 1 2 2 1 ...

output:

1:1

result:

ok single line: '1:1'

Test #7:

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

input:

1000
2 2 2 1 1 1 1 2 2 2 2 2 1 1 2 1 2 2 1 2 2 1 2 1 2 1 1 1 1 1 1 2 2 2 2 1 2 2 2 2 2 1 1 2 1 2 2 2 2 2 1 1 2 2 1 1 1 1 2 1 1 2 1 1 1 2 1 2 2 2 1 1 2 2 2 1 1 2 2 2 1 1 2 1 2 2 1 2 2 2 1 1 1 1 1 1 2 1 1 1 2 1 1 1 2 1 1 1 2 1 2 2 1 2 2 2 1 1 2 1 2 2 1 1 2 1 1 1 1 1 2 2 2 2 2 1 2 1 1 1 1 1 1 1 2 2 2 2...

output:

1:1

result:

ok single line: '1:1'

Test #8:

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

input:

1000
1 1 1 1 1 2 2 2 1 1 2 1 1 2 2 1 1 1 1 2 1 1 1 1 1 2 2 1 1 2 1 1 1 1 1 1 2 2 2 2 2 1 2 2 1 1 1 1 1 1 2 1 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 2 2 1 1 1 1 1 1 1 2 2 2 2 1 2 1 2 1 2 2 2 1 1 1 2 1 2 1 1 2 1 1 1 2 1 1 2 2 2 1 1 1 2 2 1 1 2 2 1 2 1 2 2 2 2 2 2 1 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2 1 1 2 1 1...

output:

2:0

result:

ok single line: '2:0'

Test #9:

score: 0
Accepted
time: 13ms
memory: 76440kb

input:

2000
2 1 1 1 2 1 1 2 2 2 2 2 2 2 2 2 1 2 1 1 1 1 2 2 1 1 1 2 2 1 1 1 1 1 1 1 1 1 2 2 2 1 2 2 2 1 1 2 1 2 2 1 2 1 2 2 1 2 2 2 2 2 2 1 2 1 1 2 1 2 1 1 2 2 2 1 1 2 2 1 1 1 1 1 1 2 2 2 1 1 1 2 2 1 2 1 1 2 2 1 1 1 1 2 2 2 2 2 2 1 2 2 1 2 2 2 1 2 1 1 2 1 1 2 1 2 2 1 2 2 2 2 2 2 2 1 2 1 1 1 2 2 2 2 2 2 1 2...

output:

1:1

result:

ok single line: '1:1'

Test #10:

score: 0
Accepted
time: 15ms
memory: 107504kb

input:

2662
1 2 2 1 2 1 2 1 1 1 1 1 1 1 2 2 1 2 2 1 1 1 2 2 2 1 1 1 1 2 2 1 1 2 2 2 2 1 2 2 1 2 2 1 1 1 2 1 1 1 2 1 2 1 2 1 1 1 1 1 2 2 2 2 1 1 2 2 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 2 2 1 2 2 1 2 1 2 1 2 1 2 2 2 1 2 1 2 2 1 2 2 1 2 1 1 1 1 1 1 2 2 1 1 2 1 2 2 2 1 1 1 2 2 2 2 1 2 1 2 2 2 1 2 2 1 1 2 2 1 2 1 2 1...

output:

2:0

result:

ok single line: '2:0'

Test #11:

score: 0
Accepted
time: 12ms
memory: 121208kb

input:

3000
1 2 2 1 2 2 1 2 2 2 2 1 2 1 1 1 2 1 1 2 2 2 1 2 2 1 1 2 1 2 2 2 2 1 2 1 2 2 1 2 2 2 2 1 2 2 1 1 2 1 2 1 1 2 1 2 2 1 1 1 1 2 2 2 2 1 2 2 1 2 1 2 1 2 2 1 2 2 1 1 2 1 2 2 2 2 1 2 2 2 2 2 1 1 1 1 1 1 2 1 2 2 2 1 1 1 1 2 2 1 1 2 1 2 1 1 1 2 2 2 1 1 2 1 1 2 1 1 2 2 2 2 1 1 2 2 2 2 1 1 2 1 2 1 2 1 1 2...

output:

2:0

result:

ok single line: '2:0'

Test #12:

score: 0
Accepted
time: 12ms
memory: 119544kb

input:

3000
2 2 2 2 2 1 1 2 2 2 1 1 1 2 1 1 2 1 2 1 2 2 2 2 2 2 2 1 2 2 1 1 1 2 1 1 1 1 2 2 1 2 1 1 1 1 1 2 2 2 1 1 1 2 2 1 2 1 1 1 2 1 1 1 1 1 1 1 2 2 2 2 1 2 2 2 1 2 1 2 1 1 2 2 1 2 2 2 2 2 2 2 1 2 2 1 1 2 1 2 1 2 1 1 2 2 2 2 1 1 1 1 1 2 2 1 1 1 2 1 1 1 2 1 1 1 1 1 2 1 2 2 2 2 2 1 1 2 2 1 2 2 1 2 2 1 1 2...

output:

1:1

result:

ok single line: '1:1'

Test #13:

score: 0
Accepted
time: 19ms
memory: 119464kb

input:

3000
2 2 2 1 1 2 1 1 2 1 1 1 1 2 2 2 2 2 1 2 1 2 1 2 2 2 2 2 2 1 2 1 2 1 2 1 1 2 1 2 2 2 2 2 1 2 1 2 1 1 2 1 2 2 1 1 1 2 1 2 1 2 1 2 2 2 2 2 1 1 1 2 2 1 1 2 2 1 1 2 2 2 2 1 1 2 2 2 2 2 1 2 1 1 1 2 2 1 2 2 1 2 1 2 2 1 1 1 2 1 2 1 1 2 1 1 1 2 2 2 1 1 1 1 1 2 1 1 2 2 2 2 1 1 1 1 1 1 1 2 1 1 2 1 2 1 2 2...

output:

1:1

result:

ok single line: '1:1'

Test #14:

score: 0
Accepted
time: 7ms
memory: 119452kb

input:

3000
1 1 1 1 2 2 2 2 1 2 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 2 1 2 1 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 1 1 2 2 1 1 1 2 2 1 2 2 2 2 1 1 1 1 1 1 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 2 1 2 1 2 2 1 1 2 2 2 2 1 2 2 1 1 2 2 1 1 2 1 1 2 2 2 2 1 2 2 2 1 1 1 2 1 1 1 2 2 2 1 2 1 2 2 1 2 1 2 2 1 2 1 2 1 2 2 1 2 1 2 2 1 2 1 1...

output:

1:1

result:

ok single line: '1:1'

Test #15:

score: 0
Accepted
time: 14ms
memory: 119532kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1:1

result:

ok single line: '1:1'

Subtask #2:

score: 10
Accepted

Test #16:

score: 10
Accepted
time: 1ms
memory: 5776kb

input:

5
3 3 2 5 5

output:

1:2

result:

ok single line: '1:2'

Test #17:

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

input:

5
1 2 4 1 5

output:

2:2

result:

ok single line: '2:2'

Test #18:

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

input:

20
19 20 19 1 14 14 2 9 9 17 9 9 11 11 8 1 13 3 9 4

output:

6:6

result:

ok single line: '6:6'

Test #19:

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

input:

20
9 8 16 6 14 15 9 15 6 16 14 2 14 8 14 14 3 16 6 5

output:

6:3

result:

ok single line: '6:3'

Test #20:

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

input:

20
12 12 16 16 16 16 16 16 16 16 16 12 16 12 16 16 16 12 12 12

output:

2:0

result:

ok single line: '2:0'

Test #21:

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

input:

20
9 6 15 6 9 15 10 9 10 10 15 9 6 9 10 15 6 6 6 10

output:

2:2

result:

ok single line: '2:2'

Test #22:

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

input:

20
17 7 3 10 7 20 12 3 15 7 20 5 10 13 9 2 7 10 6 12

output:

7:5

result:

ok single line: '7:5'

Test #23:

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

input:

20
6 19 17 14 19 8 11 7 16 2 4 1 7 16 8 12 1 16 2 13

output:

7:6

result:

ok single line: '7:6'

Test #24:

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

input:

20
6 4 13 4 20 6 6 3 13 4 4 3 13 20 3 13 15 3 4 13

output:

3:3

result:

ok single line: '3:3'

Test #25:

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

input:

20
1 1 1 1 1 1 4 2 3 4 2 5 5 4 1 1 1 1 1 1

output:

3:2

result:

ok single line: '3:2'

Subtask #3:

score: 26
Accepted

Test #26:

score: 26
Accepted
time: 1ms
memory: 8252kb

input:

100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

1:0

result:

ok single line: '1:0'

Test #27:

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

input:

100
9 18 16 7 4 19 3 15 16 13 20 16 7 2 3 19 5 17 15 15 3 3 5 7 19 15 15 13 18 20 10 6 17 5 5 12 3 7 7 10 11 6 17 18 8 11 16 4 7 11 18 1 5 2 7 3 9 13 7 18 12 16 15 20 12 19 12 6 18 10 16 8 15 4 17 14 15 13 9 13 15 7 6 11 20 4 13 20 17 11 17 20 6 12 20 17 2 3 2 11

output:

9:11

result:

ok single line: '9:11'

Test #28:

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

input:

200
4 6 7 2 9 6 3 6 1 6 6 2 2 7 4 4 6 4 3 2 5 9 10 7 1 10 7 7 4 4 8 7 1 4 1 10 2 5 7 2 10 2 5 3 10 9 7 7 2 9 10 8 7 9 4 10 9 2 6 2 8 6 1 8 9 3 9 2 9 6 4 8 9 10 10 1 10 8 7 3 8 7 1 7 7 6 6 7 10 3 1 7 8 3 6 9 7 5 10 5 2 5 2 10 5 3 10 6 1 9 9 8 7 9 4 3 4 1 2 3 4 2 1 3 4 7 1 10 3 1 4 4 5 7 5 1 9 7 7 1 7...

output:

6:4

result:

ok single line: '6:4'

Test #29:

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

input:

300
13 12 8 13 6 11 15 3 9 11 6 13 14 7 5 15 4 11 14 11 7 10 12 2 1 3 2 1 14 2 2 3 5 10 15 10 5 14 4 6 1 1 10 15 8 15 6 3 2 11 14 9 13 10 10 13 12 3 5 10 4 7 4 8 8 4 9 4 2 13 9 10 13 4 9 5 10 6 15 11 2 13 11 6 14 13 3 11 15 15 12 11 13 1 10 5 11 4 8 4 1 9 13 5 4 13 2 13 4 1 15 12 13 3 9 11 15 11 13 ...

output:

8:7

result:

ok single line: '8:7'

Test #30:

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

input:

10
5 2 4 8 3 1 4 6 5 8

output:

4:3

result:

ok single line: '4:3'

Test #31:

score: 0
Accepted
time: 15ms
memory: 121160kb

input:

3000
17 20 5 4 17 11 18 13 12 8 18 15 17 13 6 6 18 18 1 6 10 14 12 8 12 14 11 15 10 14 4 18 14 8 14 2 10 11 7 1 10 4 7 6 17 12 3 6 2 15 11 11 8 14 10 20 7 13 6 8 6 9 6 11 9 11 13 10 1 19 11 10 2 9 8 18 13 10 15 14 17 5 16 4 19 6 15 17 18 20 5 15 1 2 6 9 12 18 10 4 16 12 5 9 1 4 19 13 14 13 18 10 10 ...

output:

10:10

result:

ok single line: '10:10'

Test #32:

score: 0
Accepted
time: 3ms
memory: 76440kb

input:

2000
7 19 5 19 7 5 12 20 20 6 11 20 10 20 10 18 7 12 1 16 6 1 5 5 2 2 3 9 7 12 10 5 2 6 15 20 10 6 11 2 4 2 1 13 13 10 2 20 13 14 7 10 15 3 6 16 4 8 16 2 12 17 6 5 3 12 17 4 10 7 5 13 20 17 17 13 18 10 12 11 4 10 12 10 12 18 17 8 17 12 9 8 8 7 5 2 10 1 6 19 7 2 11 7 19 19 11 16 9 2 18 4 3 10 13 14 1...

output:

11:9

result:

ok single line: '11:9'

Test #33:

score: 0
Accepted
time: 7ms
memory: 69724kb

input:

1859
10 15 11 4 14 14 10 8 5 11 8 7 3 12 3 11 16 12 11 12 5 4 4 1 3 10 14 5 9 9 10 2 14 11 5 1 15 5 16 10 6 6 17 9 17 2 2 7 4 4 1 16 15 4 16 17 4 4 12 3 3 5 12 7 6 7 7 12 12 13 4 17 1 11 16 1 12 1 7 6 12 15 5 17 9 11 16 12 5 11 5 15 6 17 4 2 6 1 4 17 13 8 8 14 1 6 5 4 14 2 17 16 16 12 15 15 14 5 17 ...

output:

9:8

result:

ok single line: '9:8'

Test #34:

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

input:

333
1 1 1 1 2 2 2 1 2 1 2 2 2 2 1 1 1 1 1 2 1 2 2 1 1 1 1 2 1 2 2 1 2 1 1 1 2 2 2 2 2 1 1 2 2 1 2 2 2 2 2 2 2 1 1 2 1 1 1 1 2 1 2 1 1 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 2 2 1 2 1 1 1 2 2 2 2 1 1 2 2 2 1 1 2 2 2 2 2 1 1 1 2 2 1 1 2 1 2 2 2 1 1 2 2 2 2 1 2 2 2 1 1 2 2 2 1 1 1 1 1 1 1 1 1 2 1 2 2 2 2 1 ...

output:

2:0

result:

ok single line: '2:0'

Test #35:

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

input:

223
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1:0

result:

ok single line: '1:0'

Test #36:

score: 0
Accepted
time: 20ms
memory: 121232kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

3:1

result:

ok single line: '3:1'

Test #37:

score: 0
Accepted
time: 8ms
memory: 119612kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

6:4

result:

ok single line: '6:4'

Test #38:

score: 0
Accepted
time: 15ms
memory: 119492kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

11:9

result:

ok single line: '11:9'

Subtask #4:

score: 15
Accepted

Test #39:

score: 15
Accepted
time: 0ms
memory: 13388kb

input:

300
298 18 64 246 18 64 235 18 105 68 246 235 18 235 14 235 228 68 18 298 246 64 18 228 107 235 235 68 107 64 228 107 64 105 64 64 235 68 235 64 18 298 228 18 235 235 298 246 14 298 298 64 107 18 18 228 235 235 64 14 107 105 298 246 298 107 105 235 246 64 14 246 68 107 228 14 68 18 14 235 18 246 14 ...

output:

6:4

result:

ok single line: '6:4'

Test #40:

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

input:

252
145 210 145 13 160 164 33 252 209 169 61 244 60 110 216 85 28 121 29 100 100 76 60 133 35 241 219 30 228 158 111 22 48 180 47 137 172 209 38 231 119 92 131 49 3 159 3 222 137 79 178 53 113 87 132 18 203 71 203 150 64 169 53 221 92 154 68 242 133 35 7 147 229 42 21 134 241 209 83 213 46 153 95 21...

output:

82:78

result:

ok single line: '82:78'

Test #41:

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

input:

222
21 99 145 35 149 74 99 21 77 96 74 96 21 99 99 35 74 140 140 14 140 77 64 96 35 35 216 14 14 35 77 145 77 77 96 35 99 96 14 77 14 35 149 145 35 145 216 145 216 99 14 216 149 35 74 99 77 14 74 21 216 21 216 74 149 35 149 149 77 21 74 140 14 21 145 149 21 64 64 35 99 96 21 145 74 64 64 99 14 35 21...

output:

6:6

result:

ok single line: '6:6'

Test #42:

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

input:

300
19 135 220 172 36 223 184 82 224 149 234 30 106 221 190 63 68 230 206 95 128 148 205 62 95 231 132 26 183 153 224 226 72 218 36 129 88 60 279 113 184 88 257 36 36 231 36 178 196 199 188 63 68 265 62 16 133 255 169 299 56 164 63 45 89 171 231 45 220 148 130 231 120 26 265 129 188 113 218 183 184 ...

output:

51:46

result:

ok single line: '51:46'

Test #43:

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

input:

300
52 192 213 297 58 34 234 196 87 135 123 135 195 30 162 135 223 187 190 126 245 223 254 172 144 137 297 204 115 282 281 130 50 299 113 63 63 247 31 156 90 101 295 196 91 152 126 164 101 195 189 143 88 247 248 159 254 146 23 282 100 279 119 223 27 202 192 91 18 291 290 156 98 240 86 171 248 18 254...

output:

66:63

result:

ok single line: '66:63'

Test #44:

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

input:

300
191 67 224 199 170 45 13 257 211 88 202 72 160 188 257 4 129 292 117 165 12 15 70 78 123 67 207 99 3 25 227 225 65 288 247 223 278 88 226 154 110 129 127 9 213 202 182 63 61 60 110 213 155 283 286 6 228 51 124 122 218 60 293 173 198 205 144 182 181 37 50 237 40 211 247 65 33 76 127 111 66 29 243...

output:

91:94

result:

ok single line: '91:94'

Test #45:

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

input:

299
277 30 86 11 298 86 216 263 256 58 231 161 259 217 117 298 177 53 295 39 269 28 108 124 283 295 252 152 186 160 11 118 208 280 193 255 197 186 297 125 109 234 113 271 134 272 183 106 185 189 283 17 217 41 242 107 113 7 220 288 139 226 221 75 196 102 117 76 218 4 126 25 251 112 118 89 137 278 145...

output:

96:98

result:

ok single line: '96:98'

Test #46:

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

input:

280
148 275 248 32 163 71 147 235 227 275 257 247 264 190 119 249 209 61 212 107 40 102 81 93 5 178 106 38 176 209 144 277 224 204 271 119 263 267 271 241 11 235 21 118 99 200 192 185 52 2 23 255 269 113 6 203 210 229 241 182 205 251 264 192 103 244 23 44 30 268 170 176 66 182 10 81 274 171 120 35 2...

output:

82:76

result:

ok single line: '82:76'

Test #47:

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

input:

300
2 74 74 74 28 74 74 2 74 2 74 2 74 2 28 28 2 74 74 2 74 28 74 28 28 28 2 2 74 74 2 28 74 28 28 74 28 2 2 28 28 28 2 74 74 28 74 28 28 74 2 28 74 28 28 28 74 2 2 74 2 74 28 28 74 74 28 74 2 2 2 74 74 28 2 2 2 2 74 28 28 2 28 74 2 28 74 28 74 28 28 2 74 28 2 74 28 74 2 2 2 28 2 2 74 2 74 28 28 2 2...

output:

1:2

result:

ok single line: '1:2'

Test #48:

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

input:

297
84 84 68 38 38 247 290 247 247 234 84 68 68 290 290 247 247 84 38 38 290 290 84 68 234 234 84 290 234 234 84 38 290 234 84 68 84 234 68 38 38 247 234 68 290 84 68 290 38 247 290 290 290 247 234 84 68 68 234 247 247 38 38 290 234 247 234 68 84 247 234 247 247 38 84 234 290 290 234 68 234 247 68 8...

output:

4:2

result:

ok single line: '4:2'

Test #49:

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

input:

300
95 202 149 78 243 243 70 280 106 249 95 202 232 234 16 170 270 17 267 9 182 67 254 290 16 114 160 114 234 243 7 243 16 254 160 201 182 254 267 28 106 271 221 160 285 264 183 106 7 17 73 285 95 183 264 37 7 249 183 218 80 16 16 37 100 30 125 150 232 3 80 77 28 234 125 184 160 183 285 80 201 249 3...

output:

33:27

result:

ok single line: '33:27'

Test #50:

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

input:

250
209 136 228 157 89 243 240 96 225 96 164 240 2 74 177 28 49 7 28 177 143 19 225 136 19 146 177 240 2 109 49 28 2 189 19 74 109 240 96 164 143 109 89 2 73 157 164 42 146 157 2 228 7 42 19 136 49 225 49 228 164 96 146 177 64 239 177 237 140 209 28 140 137 143 143 157 164 137 2 74 64 7 146 74 243 2...

output:

15:15

result:

ok single line: '15:15'

Test #51:

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

input:

300
84 183 295 193 277 230 237 212 7 94 227 193 202 248 118 155 4 231 282 261 176 289 52 6 211 247 240 36 226 184 218 98 109 228 124 38 147 86 264 235 143 276 280 24 284 184 111 71 216 51 98 177 93 84 86 64 148 84 192 206 231 160 300 172 226 132 78 144 124 191 112 172 111 102 189 275 187 126 279 157...

output:

96:93

result:

ok single line: '96:93'

Test #52:

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

input:

263
16 65 117 119 104 211 172 221 83 150 141 118 126 134 52 23 107 152 210 72 165 6 76 87 222 36 10 207 28 27 157 43 91 34 106 140 5 223 121 33 133 207 95 19 101 91 225 152 4 196 224 168 146 5 199 73 40 154 224 13 125 86 239 161 120 51 61 69 34 126 46 166 93 141 129 139 231 59 51 179 15 35 52 106 22...

output:

83:79

result:

ok single line: '83:79'

Test #53:

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

input:

300
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 18 13 12 12 5 9 4 4 13 11 16 7 8 9 13 14 5 8 13 16 13 11 20 17 4 7 16 2 8 5 20 2 13 11 10 16 1...

output:

10:10

result:

ok single line: '10:10'

Test #54:

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

input:

300
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 31 21 45 16 27 46 56 28 37 49 29 9 29 51 35 42 8 19 23 38 21 48 5 49 19 22 49 19 7 42 29 36 6 4 ...

output:

23:21

result:

ok single line: '23:21'

Test #55:

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

input:

300
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 259 52 135 214 201 185 178 172 153 216 107 208 195 87 230 6 23 154 210 119 297 19 218 126 296 27...

output:

46:44

result:

ok single line: '46:44'

Test #56:

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

input:

300
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 73 112 75 90 74 90 68 16 62 106 34 49 19 118 69 66 65 38 33 49 81 61 27 17 82 97 51 119 43 118 7...

output:

37:36

result:

ok single line: '37:36'

Subtask #5:

score: 42
Accepted

Test #57:

score: 42
Accepted
time: 0ms
memory: 23872kb

input:

604
17 17 1 3 15 14 9 2 16 5 3 16 11 10 20 10 20 8 15 3 3 19 16 8 20 11 2 12 9 18 8 17 14 8 20 1 13 8 14 8 4 16 16 14 17 7 16 17 15 2 11 17 20 19 17 19 9 10 2 17 7 9 13 13 9 4 13 1 3 6 1 6 13 8 12 9 14 7 17 8 20 20 17 19 18 13 9 6 14 11 14 1 11 6 5 19 10 9 12 4 14 4 10 18 3 1 6 16 19 15 16 18 14 4 1...

output:

10:10

result:

ok single line: '10:10'

Test #58:

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

input:

439
44 231 106 44 184 431 181 162 317 27 27 6 77 77 181 226 106 106 6 431 6 181 231 106 428 77 317 55 226 184 6 184 264 55 274 328 55 264 181 162 162 317 184 431 77 231 328 184 162 317 184 84 27 317 231 84 106 428 37 317 6 226 328 231 6 27 6 44 226 162 37 6 428 55 6 317 328 317 328 6 106 162 181 226...

output:

10:10

result:

ok single line: '10:10'

Test #59:

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

input:

763
141 371 421 364 351 386 56 241 11 253 362 139 258 268 429 331 147 348 444 162 406 87 97 158 412 5 204 369 182 419 83 234 247 415 144 143 346 199 383 357 364 202 41 167 16 381 410 74 275 311 235 138 397 332 296 355 336 411 269 430 287 263 209 79 224 264 221 115 375 61 17 284 263 423 362 190 350 3...

output:

181:180

result:

ok single line: '181:180'

Test #60:

score: 0
Accepted
time: 4ms
memory: 55460kb

input:

1364
353 993 406 629 665 286 75 503 476 633 422 54 1001 828 984 125 827 432 587 760 436 486 658 15 682 452 743 407 834 928 607 161 897 1012 789 537 273 865 14 748 475 437 803 450 240 761 576 43 170 137 802 605 622 434 622 281 887 339 687 695 243 268 858 115 257 623 651 529 463 664 253 937 75 30 361 ...

output:

381:375

result:

ok single line: '381:375'

Test #61:

score: 0
Accepted
time: 16ms
memory: 121300kb

input:

3000
2655 1603 2914 180 926 1491 920 885 2013 873 2434 2985 2811 1286 516 1429 1467 2819 1392 2834 353 2312 2930 2606 231 464 2076 1835 873 1966 1062 1227 50 1004 2902 42 2057 397 1972 1652 2027 1162 422 184 2407 1135 636 2442 293 930 1512 1721 2316 731 1804 511 2095 1183 2969 1536 2048 1981 497 206...

output:

298:294

result:

ok single line: '298:294'

Test #62:

score: 0
Accepted
time: 7ms
memory: 103968kb

input:

2599
1500 1881 1412 1095 871 17 2465 1525 1617 1990 769 2409 1508 1475 174 238 67 169 2005 2582 871 624 353 331 1082 1617 117 2048 928 72 679 1921 567 2026 567 1448 1765 404 1980 2104 1920 1121 2473 481 965 873 2484 1125 99 877 1836 1082 1017 961 2125 877 295 557 1011 2442 1523 253 15 1617 986 640 2...

output:

136:136

result:

ok single line: '136:136'

Test #63:

score: 0
Accepted
time: 32ms
memory: 121824kb

input:

3000
1629 136 856 336 1502 621 2171 721 186 2058 2803 2773 1389 2457 162 2323 1453 2295 1919 1102 970 812 1095 2990 294 1411 2897 2659 621 746 1801 1903 956 1996 474 1099 2965 1479 740 2792 1919 1541 2489 1780 1367 2373 374 2038 2730 342 1083 970 977 1442 2347 1357 937 2610 103 2070 2966 2065 1555 1...

output:

365:372

result:

ok single line: '365:372'

Test #64:

score: 0
Accepted
time: 32ms
memory: 121276kb

input:

3000
1036 1479 1698 294 306 478 338 1351 1149 1982 874 60 1980 2384 2130 818 1982 1427 1760 528 2414 967 927 1036 506 563 957 1665 1700 501 1351 2778 1298 2896 1316 2290 696 2967 657 663 1723 545 2600 448 2364 2229 702 1254 2052 2035 2644 539 741 1383 2228 2050 2200 2558 1090 1446 1392 1812 889 603 ...

output:

448:443

result:

ok single line: '448:443'

Test #65:

score: 0
Accepted
time: 27ms
memory: 119544kb

input:

3000
364 364 1080 364 364 364 364 364 1080 364 1080 364 364 1080 364 1080 364 364 364 1080 364 364 1080 1080 1080 1080 1080 364 364 364 1080 364 1080 364 364 1080 364 364 1080 364 364 1080 364 364 364 364 364 364 1080 364 1080 1080 364 1080 364 1080 364 1080 1080 364 364 364 364 1080 364 364 364 108...

output:

1:1

result:

ok single line: '1:1'

Test #66:

score: 0
Accepted
time: 16ms
memory: 112696kb

input:

2795
2215 524 1034 1199 1483 522 2668 1227 128 2265 451 1757 341 2174 1029 918 111 758 1761 676 768 192 199 1844 1144 1593 148 1814 2729 1199 648 1593 1844 1735 2320 172 2344 542 2729 574 1820 49 1844 2208 95 368 1320 2306 1593 1255 1172 96 1527 719 1722 2792 1491 219 613 2654 1572 1029 626 411 2473...

output:

149:150

result:

ok single line: '149:150'

Test #67:

score: 0
Accepted
time: 19ms
memory: 121480kb

input:

2999
2591 1820 460 847 2662 2707 707 497 1430 181 1254 2439 1319 2141 2666 1655 1650 167 470 172 708 2148 1672 2015 749 1131 154 354 1558 2316 890 1873 1059 1559 1301 565 603 442 2631 1703 2005 1066 2021 505 1302 2665 1966 2005 1160 2947 1771 2678 224 329 1275 34 1659 1743 1289 2879 1949 2312 1755 2...

output:

538:564

result:

ok single line: '538:564'

Test #68:

score: 0
Accepted
time: 11ms
memory: 125236kb

input:

3000
1034 1257 668 2066 1788 404 988 620 469 2366 1375 1585 1666 674 292 1729 547 2824 834 76 1960 1183 887 1835 816 107 2171 1567 743 1772 488 742 2158 2838 416 127 1472 214 2459 2822 686 1194 2149 1282 2768 1870 1186 530 1444 2648 1776 129 1186 2092 633 2245 1449 900 2305 1159 2340 1618 1092 114 9...

output:

856:856

result:

ok single line: '856:856'

Test #69:

score: 0
Accepted
time: 15ms
memory: 125740kb

input:

3000
39 526 1996 316 1757 377 953 2448 1245 2330 1609 2244 779 259 1383 2297 1731 1579 1009 2422 2977 2228 1609 1328 2907 1492 1182 612 652 2546 1845 1176 2883 682 1445 1761 978 2371 948 512 2371 2501 1777 1623 881 2461 2072 2962 1089 800 572 2973 2132 6 2077 604 2276 1815 2230 2510 889 683 2904 768...

output:

767:742

result:

ok single line: '767:742'

Test #70:

score: 0
Accepted
time: 12ms
memory: 109700kb

input:

2758
1183 1790 1434 2360 2418 2543 118 338 2712 2292 25 1618 313 866 440 1296 3 332 2292 22 2387 2469 376 174 1484 1788 1785 738 1900 255 76 555 2486 441 606 361 1029 55 482 2533 199 397 1430 2645 1638 107 2165 37 183 1378 928 1390 1465 179 1164 1092 1981 2246 711 164 475 854 441 60 1072 1648 606 62...

output:

276:284

result:

ok single line: '276:284'

Test #71:

score: 0
Accepted
time: 5ms
memory: 21616kb

input:

572
568 449 108 280 415 387 11 43 98 429 86 447 552 137 73 197 135 12 211 238 122 8 449 406 67 382 447 312 214 157 175 84 93 415 99 155 6 268 59 211 67 27 568 192 369 568 307 107 58 43 33 192 350 406 6 498 192 549 12 133 339 320 481 135 208 175 101 6 6 351 108 556 498 447 280 339 481 27 307 260 108 ...

output:

53:51

result:

ok single line: '53:51'

Test #72:

score: 0
Accepted
time: 16ms
memory: 123812kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

272:262

result:

ok single line: '272:262'

Test #73:

score: 0
Accepted
time: 8ms
memory: 122940kb

input:

3000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

218:212

result:

ok single line: '218:212'

Test #74:

score: 0
Accepted
time: 12ms
memory: 113216kb

input:

2700
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

336:334

result:

ok single line: '336:334'

Extra Test:

score: 0
Extra Test Passed