제출 #100518

#제출 시각아이디문제언어결과실행 시간메모리
1005181Khan금 캐기 (IZhO14_divide)C++14
0 / 100
19 ms512 KiB
// 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...