Submission #102966

#TimeUsernameProblemLanguageResultExecution timeMemory
102966mraron새로운 문제 (COCI19_akvizna)C++14
0 / 130
1569 ms1152 KiB
#include<iostream> #include<vector> #include<map> #include<set> #include<cassert> #include<cassert> #include<unordered_map> #include<unordered_set> #include<functional> #include<queue> #include<stack> #include<cstring> #include<algorithm> #include<cmath> #include<sstream> #include<iomanip> #include<cstdio> #include<cstdlib> #include<numeric> using namespace std; #define all(x) (x).begin(), (x).end() #define pb push_back #define xx first #define yy second #define sz(x) (int)(x).size() #define gc getchar #define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define mp make_pair #ifndef ONLINE_JUDGE # define LOG(x) (cerr << #x << " = " << (x) << endl) #else # define LOG(x) ((void)0) #endif typedef long long ll; typedef unsigned long long ull; typedef long double ld; const double PI=3.1415926535897932384626433832795; const ll INF = 1LL<<62; const ll MINF = -1LL<<62; template<typename T> T getint() { T val=0; char c; bool neg=false; while((c=gc()) && !(c>='0' && c<='9')) { neg|=c=='-'; } do { val=(val*10)+c-'0'; } while((c=gc()) && (c>='0' && c<='9')); return val*(neg?-1:1); } double dp[100001]; int cnt[100001]; int main() { IO; int n,k,it=0; cin>>n>>k; double L=0, R=2; while(it++<40) { double mid=(L+R)/2; dp[0]=0.0; cnt[0]=0; for(int i=1;i<=n;++i) { dp[i]=0; } for(int i=0;i<=n;++i) { for(int j=1;i+j<=n;j++) { double akt=dp[i]+double(j)/double(n-i)-mid; if(dp[i+j]<akt) { dp[i+j]=akt; cnt[i+j]=cnt[i]+1; } } } if(cnt[n]<=k) { R=mid; }else { L=mid; } } cout<<fixed<<setprecision(9); cout<<dp[n]+L*cnt[n]<<"\n"; return 0; } /* double dp[3001][3001]; int main() { IO; int n,k; cin>>n>>k; dp[n][0]=0.0; for(int i=1;i<=k;++i) { for(int j=0;j<=n;++j) { for(int l=0;l<=n/i && j+l<=n;l++) { dp[j][i]=max(dp[j][i], dp[j+l][i-1]+(l>0?(double)l/(double)(j+l):0)); } } } cout<<fixed<<setprecision(10); cout<<dp[0][k]<<"\n"; return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...