# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
493577 | 2021-12-12T08:48:11 Z | reni | 학교 설립 (IZhO13_school) | C++14 | 2000 ms | 27148 KB |
#include<iostream> using namespace std; long long a[10000000], b[1000003], dp[1000000][3],n; long long rec(long long pos,long long m,long long s) { if(pos==n)return 0; long long maxi=0; if(m>0)maxi=max(maxi, rec(pos+1,m-1,s)+a[pos]); if(s>0)maxi=max(maxi, rec(pos+1,m,s-1)+b[pos]); maxi=max(maxi, rec(pos+1,m,s)); return maxi; } int main() { long long br=0,m,s,i,j; cin>>n>>m>>s; for(i=0;i<n;i++) { cin>>a[i]>>b[i]; } cout<<rec(0,m,s)<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Execution timed out | 2066 ms | 204 KB | Time limit exceeded |
5 | Execution timed out | 2080 ms | 204 KB | Time limit exceeded |
6 | Execution timed out | 2094 ms | 204 KB | Time limit exceeded |
7 | Execution timed out | 2091 ms | 588 KB | Time limit exceeded |
8 | Execution timed out | 2097 ms | 588 KB | Time limit exceeded |
9 | Execution timed out | 2094 ms | 716 KB | Time limit exceeded |
10 | Execution timed out | 2071 ms | 716 KB | Time limit exceeded |
11 | Execution timed out | 2081 ms | 716 KB | Time limit exceeded |
12 | Execution timed out | 2089 ms | 696 KB | Time limit exceeded |
13 | Execution timed out | 2082 ms | 3404 KB | Time limit exceeded |
14 | Execution timed out | 2082 ms | 7204 KB | Time limit exceeded |
15 | Execution timed out | 2071 ms | 14428 KB | Time limit exceeded |
16 | Execution timed out | 2056 ms | 16248 KB | Time limit exceeded |
17 | Execution timed out | 2087 ms | 19908 KB | Time limit exceeded |
18 | Execution timed out | 2084 ms | 21820 KB | Time limit exceeded |
19 | Execution timed out | 2092 ms | 23652 KB | Time limit exceeded |
20 | Execution timed out | 2072 ms | 27148 KB | Time limit exceeded |