| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 47837 | TheDarkning | Candies (JOI18_candies) | C++17 | 956 ms | 395448 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
▄█▀ ▀█▀ ▄▀▄ █▀ █▄█▄█ ▄▀▄ █▀ ▄█▀
<⇋⇋⇋⋛∰≓⊂(⌒,_ゝ⌒)⊃≓∰⋛⇋⇋⇋>
♔♕♖♗♘♙ ☜❷☞✪ ィℋ६ ≈ ᗫẵℜℵĬŊĞ ✪☜❷☞ ♚♛♜♝♞♟
♔♕♖♗♘♙ ♚♛♜♝♞♟
˙·٠•●♥ Ƹ̵̡Ӝ̵̨̄Ʒ ♥●•٠·˙
916 921 919 673
**/
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <time.h>
#include <map>
#include <deque>
#include <assert.h>
#include <queue>
#include <string>
#include <memory.h>
#include <set>
#include <math.h>
#define sz(s) s.size()
#define pb emplace_back
#define fr first
#define sc second
#define mk make_pair
#define int long long
#define all(s) s.begin(), s.end()
#define ok puts("ok");
using namespace std;
const int N = 2e5 + 5;
const int inf = 1e18 + 7;
int n, ar[N], dp[5000][5000];
main(){
cin >> n;
for( int i = 1; i <= n; i++ ){
scanf("%d", &ar[i]);
}
for( int i = 0; i <= n; i++ ){
for( int j = 0; j <= n; j++ ){
dp[ i ][ j ] = -inf;
}
}
dp[ 0 ][ 0 ] = 0;
dp[ 0 ][ 1 ] = 0;
dp[ 1 ][ 1 ] = ar[ 1 ];
for( int i = 2; i <= n; i++ ){
int cur = 0;
for( int j = 0; j <= i; j++ ){
cur = dp[j][ i - 1 ];
if( j )
cur = max( cur, dp[ j - 1 ][ i - 2 ] + ar[ i ] );
dp[ j ][ i ] = cur;
}
}
for( int i = 1; i <= ( n + 1 ) / 2; i++ ){
cout << dp[ i ][ n ] << endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
