| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1112014 | KALARRY | Cloud Computing (CEOI18_clo) | C++14 | 388 ms | 2208 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//chockolateman
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
long long N,M,dp[2][100005];
struct Transact
{
    long long type,c,f,v; // type is 1 for buying and 0 for selling
    bool operator < (const Transact &Other)
    {
        return make_pair(f,type) > make_pair(Other.f,Other.type);
    }
} transactions[4005];
int main()
{
    scanf("%lld",&N);
    long long total = 0;
    for(long long c,f,v,i = 1 ; i <= N ; i++)
    {
        scanf("%lld%lld%lld",&c,&f,&v);
        transactions[i] = {1,c,f,v};
        total += c;
    }
    scanf("%lld",&M);
    for(long long c,f,v,i = 1 ; i <= M ; i++)
    {
        scanf("%lld%lld%lld",&c,&f,&v);
        transactions[N+i] = {0,c,f,v};
    }
    sort(transactions+1,transactions+N+M+1);
    for(int j = 1 ; j <= total ; j++)
        dp[0][j] = - INF;
    for(int i = 1 ; i <= N+M ; i++)
    {
        for(int j = 0 ; j <= total ; j++)
        {
            dp[i%2][j] = dp[(i-1)%2][j];
            long long type = transactions[i].type;
            long long c = transactions[i].c;
            // long long f = transactions[i].f;
            long long v = transactions[i].v;
            if(type==1 && j >= c)
                dp[i%2][j] = max(dp[i%2][j],dp[(i-1)%2][j - c] - v);
            else if(type==0 && j + c <= total)
                dp[i%2][j] = max(dp[i%2][j],dp[(i-1)%2][j + c] + v);
        }
    }
    long long ans = 0;
    for(int j = 0 ; j <= total ; j++)
        ans = max(ans,dp[(N+M)%2][j]);
    printf("%lld\n",ans);
    return 0;
}
컴파일 시 표준 에러 (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... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
