답안 #1095841

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1095841 2024-10-03T10:01:04 Z owoovo 모임들 (IOI18_meetings) C++17
19 / 100
283 ms 400672 KB
#include "meetings.h"
#include<bits/stdc++.h>
#define ll long long
#define F first 
#define S second 
using namespace std;
ll dp[5010][5010],a[5010];
vector<ll> minimum_costs(vector<int> h, vector<int> l,vector<int> r) {
	int n=h.size();
	int q=l.size();
	for(int i=0;i<n;i++)a[i]=h[i];
	for(int i=0;i<n;i++){
		dp[i][i]=a[i];
		ll mx=a[i];
		for(int j=i-1;j>=0;j--){
			mx=max(mx,a[j]);
			dp[i][j]=dp[i][j+1]+mx;
		}
		mx=a[i];
		for(int j=i+1;j<n;j++){
			mx=max(mx,a[j]);
			dp[i][j]=dp[i][j-1]+mx;
		}
	}
	vector<ll> ans;
	ans.resize(q);
	for(int i=0;i<q;i++){
		ll mn=1e18;
		for(int j=l[i];j<=r[i];j++){
			mn=min(mn,dp[j][l[i]]+dp[j][r[i]]-dp[j][j]);
		}
		ans[i]=mn;
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 34 ms 82844 KB Output is correct
3 Correct 35 ms 82840 KB Output is correct
4 Correct 34 ms 82768 KB Output is correct
5 Correct 35 ms 82780 KB Output is correct
6 Correct 34 ms 82768 KB Output is correct
7 Correct 34 ms 82904 KB Output is correct
8 Correct 34 ms 82948 KB Output is correct
9 Correct 34 ms 82772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 34 ms 82844 KB Output is correct
3 Correct 35 ms 82840 KB Output is correct
4 Correct 34 ms 82768 KB Output is correct
5 Correct 35 ms 82780 KB Output is correct
6 Correct 34 ms 82768 KB Output is correct
7 Correct 34 ms 82904 KB Output is correct
8 Correct 34 ms 82948 KB Output is correct
9 Correct 34 ms 82772 KB Output is correct
10 Correct 176 ms 196696 KB Output is correct
11 Correct 271 ms 196688 KB Output is correct
12 Correct 184 ms 196688 KB Output is correct
13 Correct 283 ms 196824 KB Output is correct
14 Correct 176 ms 196816 KB Output is correct
15 Correct 183 ms 196696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 508 KB Output is correct
2 Runtime error 263 ms 400672 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 508 KB Output is correct
2 Runtime error 263 ms 400672 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 34 ms 82844 KB Output is correct
3 Correct 35 ms 82840 KB Output is correct
4 Correct 34 ms 82768 KB Output is correct
5 Correct 35 ms 82780 KB Output is correct
6 Correct 34 ms 82768 KB Output is correct
7 Correct 34 ms 82904 KB Output is correct
8 Correct 34 ms 82948 KB Output is correct
9 Correct 34 ms 82772 KB Output is correct
10 Correct 176 ms 196696 KB Output is correct
11 Correct 271 ms 196688 KB Output is correct
12 Correct 184 ms 196688 KB Output is correct
13 Correct 283 ms 196824 KB Output is correct
14 Correct 176 ms 196816 KB Output is correct
15 Correct 183 ms 196696 KB Output is correct
16 Correct 1 ms 508 KB Output is correct
17 Runtime error 263 ms 400672 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -