結果

問題 No.54 Happy Hallowe'en
ユーザー ei1333ei1333
提出日時 2014-11-06 16:46:13
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,450 bytes
コンパイル時間 1,309 ms
コンパイル使用メモリ 149,844 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-29 00:50:11
合計ジャッジ時間 3,227 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
 
template<typename T1, typename T2> istream& operator>>(istream& is, pair<T1,T2>& a){ return is >> a.first >> a.second; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1,T2>& a){ return os << a.first << " "<<a.second; }
template<typename T> istream& operator>>(istream& is, vector< T >& vc){ for(int i = 0; i < vc.size(); i++) is >> vc[i]; return is; }
template<typename T> ostream& operator<<(ostream& os, vector< T >& vc){ for(int i = 0; i < vc.size(); i++) os << vc[i] << endl; return os; }
 
#define ForEach(it,c) for(__typeof (c).begin() it = (c).begin(); it != (c).end(); it++)
#define ALL(v) (v).begin(), (v).end()
#define UNQ(s) { sort(ALL(s)); (s).erase( unique( ALL(s)), (s).end());}
#define fr first
#define sc second
 
typedef pair< int , int > Pi;
typedef pair< int , Pi > Pii;
 
typedef long long int64;
const int INF = 1 << 30;


int main()
{
  int N;
  Pi Data[10000];
  vector< bool > dp(20001, false);


  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> Data[i].first >> Data[i].second;
  }
  sort( Data, Data + N);

  dp[0] = true;
  for(int i = 0; i < N; i++){
    for(int j = Data[i].second - 1; j >= 0; j--){
      dp[j + Data[i].first] = dp[j + Data[i].first] | dp[j];
    }
  }
  int ret = 0;
  for(int i = 20000; i >= 0; i--){
    ret = max( ret, i * dp[i]);
  }

  cout << ret << endl;
  return(0);
}
0