Submission #533923

# Submission time Handle Problem Language Result Execution time Memory
533923 2022-03-07T15:54:03 Z amunduzbaev Peru (RMI20_peru) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;

#define ar array
#define int long long
const int N = 25e5 + 5;
const int mod = 1e9 + 7;
int a[N], dp[N];

signed main(){
	ios::sync_with_stdio(0); cin.tie(0);
	
	int n, k; cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	memset(dp, 127, sizeof dp);
	for(int i=0;i<n;i++){
		int mx = a[i];
		for(int j=i-1;j>=max(0ll, i-k);j--){
			dp[i] = min(dp[i], dp[j] + mx);
			mx = max(mx, a[j]);
		}
		
		if(i < k) dp[i] = min(dp[i], mx);
	}
	
	int res = 0;
	for(int i=0;i<n;i++){
		res = (res * 23ll + dp[i]) % mod;
		//~ cout<<dp[i]<<" ";
	} 
	//~ cout<<"\n";
	
	cout<<res<<"\n";
}

Compilation message

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