結果
| 問題 |
No.54 Happy Hallowe'en
|
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2014-10-31 00:45:22 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,670 bytes |
| コンパイル時間 | 2,810 ms |
| コンパイル使用メモリ | 107,392 KB |
| 実行使用メモリ | 83,972 KB |
| 最終ジャッジ日時 | 2024-12-30 14:52:17 |
| 合計ジャッジ時間 | 45,674 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 2 TLE * 6 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
class TEST{
static void Main(){
Sol mySol =new Sol();
mySol.Solve();
}
}
class Sol{
public void Solve(){
Array.Sort(P,(x,y)=>x.T>y.T?1:x.T<y.T?-1:0);
HashSet<int>[] H=new HashSet<int>[2];
H[0]=new HashSet<int>();
H[0].Add(0);
int now=0;
int next=1;
for(int i=0;i<N;i++){
now=i%2;
next=1-now;
H[next]=new HashSet<int>();
int maxx=0;
foreach(int v in H[now]){
//Console.WriteLine("{0} {1}",i,v);
if(v>=10002){
maxx=Math.Max(maxx,v);
}else{
if(v<P[i].T){
H[next].Add(v+P[i].V);
}
H[next].Add(v);
}
H[next].Add(maxx);
}
}
int max=0;
foreach(int k in H[next]){
max=Math.Max(max,k);
}
Console.WriteLine(max);
}
int N;
Pair[] P;
public Sol(){
N=ri();
P=new Pair[N];
for(int i=0;i<N;i++){
P[i]=new Pair(ria());
}
}
class Pair{
public int V;
public int T;
public Pair(int[] in_){
V=in_[0];T=in_[1];
}
}
static String rs(){return Console.ReadLine();}
static int ri(){return int.Parse(Console.ReadLine());}
static long rl(){return long.Parse(Console.ReadLine());}
static double rd(){return double.Parse(Console.ReadLine());}
static String[] rsa(){return Console.ReadLine().Split(' ');}
static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
kuuso1