답안 #862395

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
862395 2023-10-18T07:46:05 Z iskhakkutbilim Necklace (Subtask 1-3) (BOI19_necklace1) C++17
0 / 85
1 ms 604 KB
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
const int SCORE = 100;
int n, k, c;
 
int a[501][7];
//int dp[501][7][6*SCORE + 5];
 
 
main(){
   ios::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);
	cin >> n >> k >> c;
	for(int i = 1;i <= n; i++){
		for(int j = 1;j <= k; j++){
			cin >> a[i][j];
		}
	}
	vector<int> sc;
	if(k ==2){
		for(int i = 1;i <= n; i++){
			for(int j = 1;j <= n; j++){
				sc.push_back(a[i][1] + a[j][2]);
			}
		}
	}else{
		for(int i = 1;i <= n; i++){
			sc.push_back(a[i][1]);
		}
	}
	sort(all(sc));
	reverse(all(sc));
	cout << sc[c-1];
//	dp[0][0][0] = 1;
//	for(int j = 1;j <= k; j++){
//		for(int i = 1;i <= n; i++){
//			for(int last_sc = 0; last_sc <= j * 50; last_sc++){
//				dp[i][j][last_sc] = dp[i-1][j][last_sc];
//				dp[i][j][last_sc + a[i][j]]+= dp[i-1][j-1][last_sc];
//			}
//		}
//	}
//	for(int i = 26; i >= 22; i--){
//		cout << i << " = ";
//		cout << dp[n][k][i] << '\n';
//	}
	return 0;
}

Compilation message

necklace.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -