제출 #1110305

#제출 시각아이디문제언어결과실행 시간메모리
1110305hainam2k9휴가 (IOI14_holiday)C++17
0 / 100
5077 ms55976 KiB
#include <bits/stdc++.h> #include <holiday.h> #define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0) #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout) #define ll long long #define ull unsigned long long #define i128 __int128 #define db long double #define sz(a) ((int)(a).size()) #define pb emplace_back #define pf emplace_front #define pob pop_back #define pof pop_front #define lb lower_bound #define ub upper_bound #define fi first #define se second #define ins emplace using namespace std; const int MOD = 1e9+7, MAXN = 1e5+5; const string NAME = ""; ll dp[3005][8005]; ll findMaxAttraction(int n, int start, int d, int attraction[]){ ll rs=d ? attraction[start] : 0; dp[start][1]=attraction[start]; for(int i = start; i<n; ++i) for(int j = i-start+1; j<=d; ++j){ dp[i][j]=max(dp[i][j],dp[i][j-1]); for(int k = i-1; k>=start; --k) dp[i][j]=max(dp[i][j],dp[k][j-i+k-1]+attraction[i]), rs=max(rs,dp[i][j]); } for(int i = start-1; i>=0; --i) for(int j = start-i+1; j<=d; ++j){ dp[i][j]=dp[i][j-1]; for(int k = i+1; k<n&&j>k-i; ++k) dp[i][j]=max(dp[i][j],dp[k][j-k+i-1]+attraction[i]), rs=max(rs,dp[i][j]); } return rs; } //int n,start,d,a[MAXN]; //int main() //{ // tt; // if(fopen((NAME + ".INP").c_str(), "r")) fo; // cin >> n >> start >> d; // for(int i = 0; i<n; ++i) // cin >> a[i]; // cout << findMaxAttraction(n,start,d,a); //} //5 2 7 //10 2 20 30 1 //testing
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...