Submission #466990

#TimeUsernameProblemLanguageResultExecution timeMemory
466990AMO5Discharging (NOI20_discharging)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define ld long double
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define dbg if(0)
#define BUG(x) dbg cerr << (#x) << " is " << (x) << endl

const int mxn = (int)1e6+5;
const int64_t inf = 5e18;
//subtask 2

void solve(){
	int n; cin>>n;
	vector<int64_t>a(n); 
	for(auto &x:a)
	{
		cin>>x;
	}
	vector<int64_t>dp(n);
	for(int i=0; i<n; i++){
		dp[i] = in#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define ld long double
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define dbg if(0)
#define BUG(x) dbg cerr << (#x) << " is " << (x) << endl

const int mxn = (int)1e6+5;
const int64_t inf = 5e18;
//subtask 2

void solve(){
	int n; cin>>n;
	vector<int64_t>a(n); 
	for(auto &x:a)
	{
		cin>>x;
	}
	vector<int64_t>dp(n);
	for(int i=0; i<n; i++){
		dp[i] = inf;
		for(int j=i; j>=0; j--){
			int len = n-j;
			int64_t curr = (int64_t)1*len*(a[i]) + (j>0?dp[j]:(int64_t)0);
			dbg cerr<<i<<" "<<j<<" "<<curr<<"\n";
			dp[i]=min(dp[i],curr);
		}
	}
	cout<<dp.back()<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// int t=1; cin>>t; while(t--)
	solve();
	return 0;
}
f;
		for(int j=i; j>=0; j--){
			int len = n-j;
			int64_t curr = (int64_t)1*len*(a[i]) + (j>0?dp[j]:(int64_t)0);
			dbg cerr<<i<<" "<<j<<" "<<curr<<"\n";
			dp[i]=min(dp[i],curr);
		}
	}
	cout<<dp.back()<<"\n";
}

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

Compilation message (stderr)

Discharging.cpp:26:13: error: stray '#' in program
   26 |   dp[i] = in#include <bits/stdc++.h>
      |             ^
Discharging.cpp: In function 'void solve()':
Discharging.cpp:26:11: error: 'in' was not declared in this scope; did you mean 'i'?
   26 |   dp[i] = in#include <bits/stdc++.h>
      |           ^~
      |           i
Discharging.cpp:42:13: error: a function-definition is not allowed here before '{' token
   42 | void solve(){
      |             ^
Discharging.cpp:62:11: error: a function-definition is not allowed here before '{' token
   62 | int main(){
      |           ^
Discharging.cpp:68:1: error: 'f' was not declared in this scope
   68 | f;
      | ^
Discharging.cpp:38:11: warning: unused variable 'mxn' [-Wunused-variable]
   38 | const int mxn = (int)1e6+5;
      |           ^~~
Discharging.cpp:39:15: warning: unused variable 'inf' [-Wunused-variable]
   39 | const int64_t inf = 5e18;
      |               ^~~