CSES - Leirikisa 6.3.2017 - Results
Submission details
Task:Karuselli
Sender:OulaK
Submission time:2017-03-06 19:29:27 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.12 s1details
#20.00 s1details
#30.00 s1details
#40.00 s1details
#50.00 s1details
#60.04 s2details
#70.00 s2details
#80.00 s2details
#90.00 s2details
#100.00 s2details
#110.11 s3details
#120.00 s3details
#130.00 s3details
#140.00 s3details
#150.00 s3details

Code

#include<bits/stdc++.h>
using namespace std;

vector<int> x[14];
int e[(int)1e5];
int n, m;
int d = 0;

vector<int> v;
void r(int a, int p, int s) {

	if (a >= n) {
		if (d < s) d = s;
		for (int i : v) cout << i << " ";
		cout << "\n";
		return;
	}

	for (int i = 0; i < m; ++i) {
		if (e[i]) continue;
		e[i] = 1;
		v.push_back(x[a][i]);
		r(a + 1, i + 1, s + x[a][i]);
		v.pop_back();
		e[i] = 0;
	}
}

int main() {

	cin >> n >> m;

	for (int i = 0; i < n; ++i) {
		for (int ii = 0; ii < m; ++ii) {
			int a; cin >> a;
			x[i].push_back(a);
		}
	}

	for (int i = 0; i < m; ++i) {
		bool b = false;
		for (int ii = 0; ii < n; ++ii) {
			if (x[ii][i] > m / 3) b = true;
		}

		if (!b) {
			for (int ii = 0; ii < n; ++ii) {
				x[ii].erase(x[ii].begin() + i);
			}
		}
	}

	memset(e, 0, sizeof(int) * m);
	r(0, 0, 0);
	cout << d << "\n";
	
	return 0;
}

Test details

Test 1

Group: 1

Verdict:

input
1 100000
557222713 738086719 759310230 ...

correct output
999997412

user output
557222713 
738086719 
759310230 
577661374 
349589341 
...

Test 2

Group: 1

Verdict:

input
2 100000
173028329 323213810 439376948 ...

correct output
1999979389

user output
(empty)

Test 3

Group: 1

Verdict:

input
2 100000
499570894 150469086 335977485 ...

correct output
1999973920

user output
(empty)

Test 4

Group: 1

Verdict:

input
2 100000
863032160 931625464 885185608 ...

correct output
1999939689

user output
(empty)

Test 5

Group: 1

Verdict:

input
2 100000
831463088 525853809 390350738 ...

correct output
1999969705

user output
(empty)

Test 6

Group: 2

Verdict:

input
1 200
344318490 251860941 939326382 ...

correct output
998010019

user output
344318490 
251860941 
939326382 
797272644 
582572755 
...

Test 7

Group: 2

Verdict:

input
14 200
43513423 154416018 137660602 1...

correct output
13918226615

user output
(empty)

Test 8

Group: 2

Verdict:

input
14 200
881307544 967733810 371467276 ...

correct output
13961979091

user output
(empty)

Test 9

Group: 2

Verdict:

input
14 200
522563563 350867137 498280483 ...

correct output
13912986556

user output
(empty)

Test 10

Group: 2

Verdict:

input
14 200
852825364 914968833 967854069 ...

correct output
13929235436

user output
(empty)

Test 11

Group: 3

Verdict:

input
1 100000
157285470 474162109 440472842 ...

correct output
999998218

user output
157285470 
474162109 
440472842 
422674271 
82463222 
...

Test 12

Group: 3

Verdict:

input
14 100000
971542960 589024445 443526352 ...

correct output
13999781843

user output
(empty)

Test 13

Group: 3

Verdict:

input
14 100000
255470528 36303969 757946964 7...

correct output
13999894454

user output
(empty)

Test 14

Group: 3

Verdict:

input
14 100000
18178744 935999032 93142616 43...

correct output
13999804193

user output
(empty)

Test 15

Group: 3

Verdict:

input
14 100000
316827351 638928258 809826490 ...

correct output
13999909014

user output
(empty)