SRM492 Div2 Easy(250) TimeTravellingCellar

TimeTravellingCellar

真面目に計算するのは面倒くさそうなので、全通り試す。

#include <vector>
using namespace std;

class TimeTravellingCellar{public:
int determineProfit( vector <int> profit, vector <int> decay )
{
    int n = (int)profit.size();
    int ans = 0;
    for ( int i=0; i<n; i++ )
        for ( int j=0; j<n; j++ )
        if ( i != j )
            ans = max( ans, profit[i]-decay[j] );
    return ans;
}};