제출 #1121021

#제출 시각아이디문제언어결과실행 시간메모리
1121021Tsagana금 캐기 (IZhO14_divide)C++14
48 / 100
1058 ms2772 KiB
#include<bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define int long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second

using namespace std;

int g[100001];
int e[100001];
vector<int> v;

void solve () {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int x; cin >> x >> g[i] >> e[i]; v.pb(x);
	}
	
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int c = e[i]-1;
		int val = g[i];
		int l = i, r = i+1;

		ans = max(ans, val);
		for (int j = i+1; j < n; j++) {
			c += e[j];
			val += g[j];
			if (v[j] - v[i] <= c) ans = max(ans, val);
		}
	}
	cout << ans;
}
signed main() {IOS solve(); return 0;}

컴파일 시 표준 에러 (stderr) 메시지

divide.cpp: In function 'void solve()':
divide.cpp:31:7: warning: unused variable 'l' [-Wunused-variable]
   31 |   int l = i, r = i+1;
      |       ^
divide.cpp:31:14: warning: unused variable 'r' [-Wunused-variable]
   31 |   int l = i, r = i+1;
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...