# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
55138 |
2018-07-06T06:06:21 Z |
노영훈(#1526) |
만두 (JOI14_ho_t2) |
C++11 |
|
21 ms |
764 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=500010, inf=2e9;
int n, m;
int P[10010];
int S[10010];
int E[510];
int C[510];
int D[10010];
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>m>>n;
for(int i=1; i<=m; i++) cin>>P[i];
for(int i=1; i<=n; i++) cin>>C[i]>>E[i];
sort(P+1, P+m+1, greater<int>());
for(int i=1; i<=m; i++) S[i]=S[i-1]+P[i];
for(int i=1; i<=m; i++) D[i]=inf;
D[0]=0;
for(int i=1; i<=n; i++){
for(int j=m; j>=0; j--)
D[min(j+C[i], m)]=min(D[min(j+C[i], m)], D[j]+E[i]);
}
int ans=0;
for(int i=1; i<=m; i++) ans=max(ans, S[i]-D[i]);
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
560 KB |
Output is correct |
4 |
Correct |
3 ms |
596 KB |
Output is correct |
5 |
Correct |
3 ms |
612 KB |
Output is correct |
6 |
Correct |
2 ms |
612 KB |
Output is correct |
7 |
Correct |
2 ms |
612 KB |
Output is correct |
8 |
Correct |
2 ms |
612 KB |
Output is correct |
9 |
Correct |
4 ms |
612 KB |
Output is correct |
10 |
Correct |
5 ms |
612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
704 KB |
Output is correct |
2 |
Correct |
13 ms |
704 KB |
Output is correct |
3 |
Correct |
12 ms |
704 KB |
Output is correct |
4 |
Correct |
15 ms |
704 KB |
Output is correct |
5 |
Correct |
10 ms |
748 KB |
Output is correct |
6 |
Correct |
3 ms |
748 KB |
Output is correct |
7 |
Correct |
8 ms |
748 KB |
Output is correct |
8 |
Correct |
13 ms |
748 KB |
Output is correct |
9 |
Correct |
4 ms |
748 KB |
Output is correct |
10 |
Correct |
11 ms |
748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
560 KB |
Output is correct |
4 |
Correct |
3 ms |
596 KB |
Output is correct |
5 |
Correct |
3 ms |
612 KB |
Output is correct |
6 |
Correct |
2 ms |
612 KB |
Output is correct |
7 |
Correct |
2 ms |
612 KB |
Output is correct |
8 |
Correct |
2 ms |
612 KB |
Output is correct |
9 |
Correct |
4 ms |
612 KB |
Output is correct |
10 |
Correct |
5 ms |
612 KB |
Output is correct |
11 |
Correct |
16 ms |
704 KB |
Output is correct |
12 |
Correct |
13 ms |
704 KB |
Output is correct |
13 |
Correct |
12 ms |
704 KB |
Output is correct |
14 |
Correct |
15 ms |
704 KB |
Output is correct |
15 |
Correct |
10 ms |
748 KB |
Output is correct |
16 |
Correct |
3 ms |
748 KB |
Output is correct |
17 |
Correct |
8 ms |
748 KB |
Output is correct |
18 |
Correct |
13 ms |
748 KB |
Output is correct |
19 |
Correct |
4 ms |
748 KB |
Output is correct |
20 |
Correct |
11 ms |
748 KB |
Output is correct |
21 |
Correct |
21 ms |
748 KB |
Output is correct |
22 |
Correct |
13 ms |
748 KB |
Output is correct |
23 |
Correct |
18 ms |
748 KB |
Output is correct |
24 |
Correct |
12 ms |
748 KB |
Output is correct |
25 |
Correct |
15 ms |
748 KB |
Output is correct |
26 |
Correct |
16 ms |
748 KB |
Output is correct |
27 |
Correct |
5 ms |
748 KB |
Output is correct |
28 |
Correct |
12 ms |
748 KB |
Output is correct |
29 |
Correct |
12 ms |
752 KB |
Output is correct |
30 |
Correct |
12 ms |
764 KB |
Output is correct |