結果
問題 |
No.555 世界史のレポート
|
ユーザー |
![]() |
提出日時 | 2025-05-16 16:54:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,818 bytes |
コンパイル時間 | 2,036 ms |
コンパイル使用メモリ | 195,512 KB |
実行使用メモリ | 19,272 KB |
最終ジャッジ日時 | 2025-05-16 16:54:40 |
合計ジャッジ時間 | 8,563 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:41:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 41 | freopen("ctrlcv.in","r",stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ main.cpp:42:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 42 | freopen("ctrlcv.out","w",stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
/* ݲգ ⲻ꣬ ߽粻У ̰IJ֤ D P ˳ СٵȺţ ͳһ Խ粻жϣ Բעͣ l l ˳ 㲻˭ң ʮ OI ࣬ ᡣ */ #include<bits/stdc++.h> using namespace std; #define int __int128 //#define eps 1e-9 //#define ENF 1e13 const int N=2e6; const int mod=1e9+7; inline int read() { int x=0,f=1;char ch=getchar(); while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();} while (ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-48;ch=getchar();} return x*f; } void write(int x) { if(x<0)putchar('-'),x=-x; if(x<10)putchar(x+'0'); else write(x/10),putchar(x%10+'0'); } int n; int c,v; int dp[N]; signed main(){ freopen("ctrlcv.in","r",stdin); freopen("ctrlcv.out","w",stdout); n=read(); c=read(),v=read(); dp[1]=0; n<<=1; int U=1; int u=0; while(U<=n){ U*=2; u++; } u++; int all=0; for(int i=1;i<=n;++i)dp[i]=LONG_LONG_MAX; dp[1]=0; for(int k=1;k<=n;k++){ all=k; int sum=0; for(int j=all*2;j<=n;j+=all){ sum++; dp[j]=min(dp[j],dp[all]+c+v*sum); } } int ans=LONG_LONG_MAX; for(int i=n/2;i<=n;i++)ans=min(ans,dp[i]); write(ans); cout<<"\n"; return 0; } // ǫ롸ϣš֮AC⣡ // ijһգk䡣̧ͷǿǿա // ŮԸΪ˵İ¡ // 绯ĺԡȸƵӣٻ̸֯衣 // ڴأһͬһѿ // ɡ֮ʱ // ȥ֮ʱ // ʹ˸ɣ硣 // ˺СȺǡҫΪ // ˺СٻţΪҴδȥ // 뽫ҵļҵĻҵİ֯ӣǿήĴء // Ȼ覵ġ֮ɡ // Ϊϣš // ߣ֮ߡ