#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;
#define pb emplace_back
#define mp make_pair
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define ALL(X) X.begin(),X.end()
#define SZ(X) (int)X.size()
#define MAXN 1001000
#define INF 1e9
int N,K,C;
int mem[510][10];
vi st;
vi cur;
void rec(){
if (SZ(cur) == K+1){
// for (auto i:cur)cout<<i<<' ';cout<<'\n';
int ans = 0;
for (int i=0;i<K;++i){
int t=0;
for (int j=1;j<SZ(cur);++j)t=max(t,mem[cur[j]][i]);
ans += t;
}
st.pb(ans);
return;
}
int lst = cur.back()+1;
for (int i=lst;i<=N;++i){
cur.pb(i);
rec();
cur.pop_back();
}
}
int main(){
// freopen("in.txt","r",stdin);
cin>>N>>K>>C;
for (int i=1;i<=N;++i)for (int j=0;j<K;++j)cin>>mem[i][j];
cur.pb(0);
rec();
sort(ALL(st));
// for (auto i : st)cout<<i<<' ';cout<<'\n';
cout<<st[SZ(st) - C];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
1520 KB |
Output is correct |
2 |
Correct |
13 ms |
1520 KB |
Output is correct |
3 |
Correct |
11 ms |
1520 KB |
Output is correct |
4 |
Correct |
8 ms |
1520 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
587 ms |
33316 KB |
Output is correct |
2 |
Correct |
579 ms |
33352 KB |
Output is correct |
3 |
Correct |
604 ms |
33340 KB |
Output is correct |
4 |
Correct |
577 ms |
33340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1254 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
1520 KB |
Output is correct |
2 |
Correct |
13 ms |
1520 KB |
Output is correct |
3 |
Correct |
11 ms |
1520 KB |
Output is correct |
4 |
Correct |
8 ms |
1520 KB |
Output is correct |
5 |
Correct |
587 ms |
33316 KB |
Output is correct |
6 |
Correct |
579 ms |
33352 KB |
Output is correct |
7 |
Correct |
604 ms |
33340 KB |
Output is correct |
8 |
Correct |
577 ms |
33340 KB |
Output is correct |
9 |
Runtime error |
1254 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
10 |
Halted |
0 ms |
0 KB |
- |