Submission #596393

#TimeUsernameProblemLanguageResultExecution timeMemory
596393DeepessonPeru (RMI20_peru)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define MAX 2005 using ll = long long; ll inf = 1LL<<60LL; ll dp[MAX]; int N,K; ll array[MAX]; ll MOD = 1e9+7; ll expo[MAX]; ll gera_hash(void){ ll hash = 0; for(int i=0;i!=N;++i){ hash = (hash + (dp[i]*expo[N-1-i]))%MOD; } return hash; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); std::cin>>N>>K; for(int i=0;i!=N;++i)std::cin>>array[i]; expo[0]=1; for(int i=1;i!=MAX;++i)expo[i]=(23LL*expo[i-1])%MOD; for(auto&x:dp)x=inf; { ll max=0; for(int i=0;i!=K;++i){ max=std::max(max,array[i]); dp[i]=max; } } for(int i=0;i!=N;++i){ ll custo=0; for(int j=i;j!=std::max(-1,i-K-1);--j){ custo=std::max(custo,array[j]); dp[i]=std::min(dp[i],custo+dp[j]); } } for(int i=0;i!=N;++i){ // std::cout<<dp[i]<<" \n"[i==N-1]; } std::cout<<gera_hash()<<"\n"; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc6ziFt5.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccuEu0X8.o:peru.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc6ziFt5.o: in function `main':
grader.cpp:(.text.startup+0x144): undefined reference to `solve(int, int, int*)'
collect2: error: ld returned 1 exit status