답안 #659616

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
659616 2022-11-18T18:52:00 Z jcelin Peru (RMI20_peru) C++14
컴파일 오류
0 ms 0 KB
#include "peru.h"
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;

#define ii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define vpll vector<pll>
#define matrix vector<vi>
#define matrixLL vector<vll>
#define vs vector<string>
#define vui vector<ui>
#define msi multiset<int>
#define mss multiset<string>
#define si set<int>
#define ss set<string>
#define PB push_back
#define PF push_front
#define PPB pop_back
#define PPF pop_front
#define X first
#define Y second
#define MP make_pair
#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()

const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const int dxx[] = {-1, 1, 0, 0, 1, 1, -1, -1};
const int dyy[] = {0, 0, -1, 1, -1, 1, -1, 1};
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ld pi = 3.14159265;
const int mod = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 7;
const int inf = mod;
const ll INF = 1e18;
const ll zero = ll(0);
const int logo = 20;
const int off = 1 << logo;
const int trsz = off << 1;

int add(ll a, ll b){
	return (a + b) % mod;
}

int mul(ll a, ll b){
	return (a * b) % mod;
}

ll dp[MAXN];

int solve(int n, int k, vi arr){
	deque<int> dq;
	multiset<ll> m;
	si s;
	int ret = 0;
	REP(i, n){
		while(!dq.empty() and dq.front() <= i - k){
			int j = dq.front();
			dq.PPF();
			if(!dq.empty()) m.erase(m.find(dp[j] + arr[dq.front()]));
		}
		
		while(!dq.empty() and arr[dq.back()] <= arr[i]){
			int j = dq.back();
			dq.PPB();
			if(!dq.empty()) m.erase(m.find(dp[dq.back()] + arr[j])); 
		}
		
		
		dp[i] = INF;
		if(!dq.empty()) m.insert(dp[dq.back()] + arr[i]);
		dq.PB(i);
		if(!m.empty()) dp[i] = *m.begin();
		
		if(i < k) dp[i] = min(dp[i], (ll)arr[dq.front()]);
		else dp[i] = min(dp[i], arr[dq.front()] + dp[i - k]);
		ret = add(mul(23, ret), dp[i]);
	}
	return ret;
}
/*

void solv(){
	int n, k;
	cin >> n >> k;
	vi arr; arr.clear();
	REP(i, n){
		int x;
		cin >> x;
		arr.PB(x);
	}
	
	cout << solve(n, k, arr);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1;
	//cin >> t;
	while(t--)solv();
	return 0;
}


*/

Compilation message

/usr/bin/ld: /tmp/ccA1Sgqm.o: in function `main':
grader.cpp:(.text.startup+0x144): undefined reference to `solve(int, int, int*)'
collect2: error: ld returned 1 exit status