| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 25554 | zigui | 스트랩 (JOI14_straps) | C++14 | 26 ms | 32540 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MX = 2005;
ll T[MX][MX];
pii D[MX];
int N;
int main()
{
scanf("%d", &N);
for(int i = 1; i <= N; i++) scanf("%d%d", &D[i].first, &D[i].second), D[i].first--;
sort(D+1, D+N+1);
reverse(D+1, D+N+1);
for(int i = 2; i <= N; i++) T[0][i] = -2e9;
for(int i = 1; i <= N; i++){
for(int j = 0; j <= N; j++) T[i][j] = T[i-1][j];
for(int j = 0; j <= N; j++){
int w = j + D[i].first;
if( w < 0 ) continue;
if( w > N ) w = N;
T[i][w] = max(T[i][w], T[i-1][j] + D[i].second);
}
}
ll mx = 0;
for(int i = 0; i <= N; i++) mx = max(mx, T[N][i]);
printf("%lld\n", mx);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
