이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// In the name of GOD
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
#define BeGood ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define orset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define nl '\n'
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
typedef long long ll;
typedef double db;
const int N = 1e5 + 4;
const int M = 1e9 + 7;
int n;
long long g[N], e[N];
long long a[N];
long long ans;
int main(){
BeGood
cin >> n;
for(int i = 1; i <= n; ++i){
cin >> a[i];
int q, w;
cin >> q >> w;
g[i] = g[i - 1] + q;
e[i] = e[i - 1] + w;
}
for(int i = 1; i <= n; ++i){
ans = max(ans, g[i] - g[i - 1]);
for(int j = i + 1; j <= n; ++j){
if(e[j] - e[i - 1] == a[j] - a[i]){
ans = max(ans, g[j] - g[i - 1]);
}
}
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |