2010-08-23から1日間の記事一覧

SRM479 Div2 Medium(500) TheCoffeeTimeDivTwo

TheCoffeeTimeDivTwo茶とコーヒーを同時にフラスコに入れることはできない。それぞれ遠い方から順に7人ずつ配っていけば良い。 #include <vector> #include <algorithm> using namespace std; class TheCoffeeTimeDivTwo { public: int find( int n, vector <int> tea ); }; int The</int></algorithm></vector>…

SRM479 Div2 Easy(250) TheAirTripDivTwo

TheAirTripDivTwo #include <vector> using namespace std; class TheAirTripDivTwo { public: int find( vector <int> flights, int fuel ); }; int TheAirTripDivTwo::find( vector <int> flights, int fuel ) { int n = (int)flights.size(); for ( int i=0; i</int></int></vector>

SRM479 Div1 Medium(500) TheAirTripDivOne

TheAirTripDivOne最小の待ち時間をなるべく長くすることでフライトの遅れに対して安全になる、ということだろうか? 二分探索。safetyをある値として、timeまでに街nに辿り着けるかを調べる。 #include <string> #include <vector> #include <numeric> #include <algorithm> #include <sstream> using name</sstream></algorithm></numeric></vector></string>…

SRM479 Div2 Hard(1000) TheBoardingDivTwo

TheBoardingDivTwo全通り試すだけ。後ろの乗客は、前の乗客が移動する時は移動できるけど、前の乗客が座る時は移動できない、ということに引っかかった。このために着席時間を75秒にするなら、制限時間も1秒増やす必要がある。 #include <vector> #include <algorithm> using na</algorithm></vector>…