답안 #584245

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
584245 2022-06-27T05:21:24 Z temporary_juggernaut Olympiads (BOI19_olympiads) C++14
44 / 100
1985 ms 262144 KB
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
#define USING_ORDERED_SET 0
#if USING_ORDERED_SET
#include<bits/extc++.h>
using namespace __gnu_pbds;
template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#endif
template<class T>void umax(T &a,T b){if(a<b)a=b;}
template<class T>void umin(T &a,T b){if(b<a)a=b;}
#ifdef juggernaut
    #define printl(args...) printf(args)
#else
    #define printl(args...) 0
#endif
int a[505][9];
int mx[9];
int n,k,m;
vector<int>all,id;
void go(int pos){
	if(pos==k){
		for(int i=0;i<k;i++)mx[i]=0;
		for(int to:id)
			for(int i=0;i<k;i++)umax(mx[i],a[to][i]);
		int sum=0;
		for(int i=0;i<k;i++)sum+=mx[i];
		all.push_back(sum);
		return;
	}
	for(int i=id.back()+1;i<n;i++){
		id.push_back(i);
		go(pos+1);
		id.pop_back();
	}
}
int main(){
	scanf("%d%d%d",&n,&k,&m);
	for(int i=0;i<n;i++)
	for(int j=0;j<k;j++)scanf("%d",&a[i][j]);
	for(int i=0;i<n;i++){
		id.push_back(i);
		go(1);
		id.pop_back();
	}
	sort(all.begin(),all.end());
	reverse(all.begin(),all.end());
	cout<<all[m-1];
}

Compilation message

olympiads.cpp: In function 'int main()':
olympiads.cpp:41:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |  scanf("%d%d%d",&n,&k,&m);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
olympiads.cpp:43:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |  for(int j=0;j<k;j++)scanf("%d",&a[i][j]);
      |                      ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 976 KB Output is correct
2 Correct 8 ms 976 KB Output is correct
3 Correct 8 ms 976 KB Output is correct
4 Correct 4 ms 944 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 528 ms 16840 KB Output is correct
2 Correct 502 ms 16840 KB Output is correct
3 Correct 564 ms 16896 KB Output is correct
4 Correct 494 ms 16844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1985 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 976 KB Output is correct
2 Correct 8 ms 976 KB Output is correct
3 Correct 8 ms 976 KB Output is correct
4 Correct 4 ms 944 KB Output is correct
5 Correct 528 ms 16840 KB Output is correct
6 Correct 502 ms 16840 KB Output is correct
7 Correct 564 ms 16896 KB Output is correct
8 Correct 494 ms 16844 KB Output is correct
9 Runtime error 1985 ms 262144 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -