結果

問題 No.54 Happy Hallowe'en
ユーザー ss_koishiss_koishi
提出日時 2014-11-06 17:02:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 706 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 72,472 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-30 01:37:08
合計ジャッジ時間 3,536 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 42 ms
4,376 KB
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 164 ms
4,376 KB
testcase_13 RE -
testcase_14 WA -
testcase_15 AC 2 ms
4,376 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#define INF (2 << 24)
using namespace std;

int n;
bool dp[10001];
bool chk[10001];
vector <pair<int, int> > vt;

    
int main(){
  
  cin >> n;
  for(int i = 0; i < n; i++){
    int v, t; cin >> v >> t;
    vt.push_back(make_pair(t, v));
  }

  sort(vt.begin(), vt.end());
  memset(chk, true, sizeof(chk));
  
  dp[0] = true;
  for(int i = 0; i <= 10000; i++){
    for(int j = 0; j < n; j++){
      if(dp[i] && i < vt[j].first)
	dp[i + vt[j].second] = true;
    }
  }
  
  for(int i = 10000; i >= 0; i--){
    if(dp[i]){
      cout << i << endl;
      break;
    }
  }
}
0