# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
96165 |
2019-02-06T15:01:08 Z |
AKaan37 |
Schools (IZhO13_school) |
C++17 |
|
2000 ms |
22520 KB |
#include <bits/stdc++.h>
using namespace std;
typedef pair< int,int > PII;
typedef long long int lo;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (bas+son)/2
const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 1000005;
const lo mod = 1000000007;
lo n,m,cev,b,a[li],hak1,hak2;
//~ map<int,int>
string s;
pair<lo,lo> p[li];
pair<lo,lo> pp[li];
vector<int> v;
lo f(lo sira,lo hakk,lo hakk1){
lo mx=-inf;
if(hakk<0) return -inf;
if(hakk1<0) return -inf;
if(sira>n){
if(hakk==0 && hakk1==0)
return 0;
return -inf;
}
mx=max(mx,f(sira+1,hakk-1,hakk1)+p[sira].fi);
mx=max(mx,f(sira+1,hakk,hakk1-1)+p[sira].se);
mx=max(mx,f(sira+1,hakk,hakk1));
return mx;
}
int main(){
scanf("%lld %lld %lld",&n,&hak1,&hak2);
FOR{
scanf("%lld %lld",&p[i].fi,&p[i].se);
//~ p[i].se=pp[i].fi;
//~ pp[i].se=p[i].fi;
}
//~ sort(p+1,p+n+1);
//~ sort(pp+1,pp+n+1);
//~ reverse(p+1,p+n+1);
//~ reverse(pp+1,pp+n+1);
printf("%lld\n",f(1,hak1,hak2));
return 0;
}
Compilation message
school.cpp: In function 'int main()':
school.cpp:47:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld %lld %lld",&n,&hak1,&hak2);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
school.cpp:49:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld %lld",&p[i].fi,&p[i].se);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
408 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Execution timed out |
2057 ms |
408 KB |
Time limit exceeded |
5 |
Execution timed out |
2057 ms |
376 KB |
Time limit exceeded |
6 |
Execution timed out |
2064 ms |
376 KB |
Time limit exceeded |
7 |
Execution timed out |
2082 ms |
632 KB |
Time limit exceeded |
8 |
Execution timed out |
2078 ms |
632 KB |
Time limit exceeded |
9 |
Execution timed out |
2066 ms |
636 KB |
Time limit exceeded |
10 |
Execution timed out |
2075 ms |
632 KB |
Time limit exceeded |
11 |
Execution timed out |
2073 ms |
632 KB |
Time limit exceeded |
12 |
Execution timed out |
2076 ms |
632 KB |
Time limit exceeded |
13 |
Execution timed out |
2074 ms |
2936 KB |
Time limit exceeded |
14 |
Execution timed out |
2054 ms |
6008 KB |
Time limit exceeded |
15 |
Execution timed out |
2057 ms |
12024 KB |
Time limit exceeded |
16 |
Execution timed out |
2057 ms |
13560 KB |
Time limit exceeded |
17 |
Execution timed out |
2024 ms |
16760 KB |
Time limit exceeded |
18 |
Execution timed out |
2054 ms |
18168 KB |
Time limit exceeded |
19 |
Execution timed out |
2054 ms |
19704 KB |
Time limit exceeded |
20 |
Execution timed out |
2070 ms |
22520 KB |
Time limit exceeded |