Runtime Error code 3 for GNU C++ 17
Разница между en2 и en3, 598 символ(ов) изменены
I submitted a dp solution to problem 996A of Hit The Lottery. I didnt find any error in my code and logic seems to be fine. Can someone tell me why am I getting this error. I am new to CP and would appreciate if the nuances are clearly highlighted to me.↵
https://codeforces.com/813938/2021-04-21.png

~~~~~↵
#include<bits/stdc++.h>↵
using namespace std;↵
#define min(a,b) ((a<=b)?a:b)↵
typedef long long ll;↵
int main()↵
{↵
    vector<long long int> v1 = {1, 5, 10, 20, 100};↵
    long long int n;↵
    cin>>n;↵
    vector<long long int> dp(n+1,0);↵
    dp[0] = 1;↵
    long long int min;↵
    for(int i = 1;i<=n;i++)↵
    {↵
        min = dp[i - 1] + 1;↵
        for(auto j:v1)↵
        {↵
            if(j<=i&&(dp[i - j]+dp[j]<min))↵
            {↵
                min = dp[i - j] + dp[j];↵
            }↵
        }↵
        dp[i] = min;↵
    }↵
    cout<<dp[n];↵
    return 0;↵
}↵
~~~~~↵

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский shubro18 2021-04-21 10:02:34 598
en2 Английский shubro18 2021-04-21 09:44:07 46 Tiny change: 'ted to me.' -> 'ted to me.\nhttps://codeforces.com/813938/2021-04-21.png'
en1 Английский shubro18 2021-04-21 09:39:01 289 Initial revision (published)