Submission #148038

# Submission time Handle Problem Language Result Execution time Memory
148038 2019-08-31T11:55:57 Z MvC Olympiads (BOI19_olympiads) C++11
13 / 100
12 ms 1020 KB
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
//#include "boxes.h"
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<61);
const int inf=(1<<30);
const int nmax=1e3+50;
const int mod=1e9+7;
using namespace std;
int n,k,c,a[nmax][10],nr,i,j,t;
vector<int>vc;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>k>>c;
	for(i=1;i<=n;i++)for(j=1;j<=k;j++)cin>>a[i][j];
	if(k==1)
	{
		for(i=1;i<=n;i++)
		{
			nr=0;
			for(j=1;j<=k;j++)nr+=a[i][j];
			vc.pb(nr);
		}
	}
	else if(k==2)
	{
		for(i=1;i<=n;i++)
		{
			for(j=i+1;j<=n;j++)
			{
				nr=0;
				for(t=1;t<=k;t++)nr+=max(a[i][t],a[j][t]);
				vc.pb(nr);
			}
		}
	}
	sort(vc.begin(),vc.end());
	reverse(vc.begin(),vc.end());
	cout<<vc[c-1]<<endl;
	return 0;
}

Compilation message

olympiads.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
olympiads.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1016 KB Output is correct
2 Correct 11 ms 1016 KB Output is correct
3 Correct 9 ms 1016 KB Output is correct
4 Correct 6 ms 1020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1016 KB Output is correct
2 Correct 11 ms 1016 KB Output is correct
3 Correct 9 ms 1016 KB Output is correct
4 Correct 6 ms 1020 KB Output is correct
5 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -