Submission #795396

#TimeUsernameProblemLanguageResultExecution timeMemory
795396vjudge1Copy and Paste 3 (JOI22_copypaste3)C++17
5 / 100
1 ms340 KiB
#ifdef Home #define _GLIBCXX_DEBUG #endif // Home #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; main() { #ifdef Home freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif // Home ios_base::sync_with_stdio(0); cin.tie(0); ll n, a, b, c, d = 0; string s; cin >> n >> s; cin >> a >> b >> c; ll dp[n + 1]; dp[0] = 0; for(int i = 1; i <= n; ++ i) { dp[i] = 1e18; } for(int i = 1; i <= n; ++ i) { dp[i] = min(dp[i], dp[i - 1] + a); for(int j = i + i; j <= n; j += i) { dp[j] = min(dp[j], dp[i] + b + (j / i) * c); } } cout << dp[n]; }

Compilation message (stderr)

copypaste3.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main() {
      | ^~~~
copypaste3.cpp: In function 'int main()':
copypaste3.cpp:20:20: warning: unused variable 'd' [-Wunused-variable]
   20 |     ll n, a, b, c, d = 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...