Submission #100495

# Submission time Handle Problem Language Result Execution time Memory
100495 2019-03-11T18:37:57 Z 1Khan Divide and conquer (IZhO14_divide) C++14
0 / 100
16 ms 644 KB
/// 1n  the  name  of  GOD

#include <bits/stdc++.h>
using   namespace        std;

#define ko               exit(0);
#define nl               '\n'
#define ios              ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define sz(s)            (int)s.size()
#define all(s)           s.begin(), s.end()
#define oll(s, n, c)     (s) + (c), s + (n) + c
#define pb               push_back
#define ff               first
#define ss               second
#define pii              pair<int, int>

typedef long long ll;
typedef double db;

const int N = 1e5 + 111;
const int M = 1e9 + 7;

int n;
pair<ll, pair<ll, ll>> p[N];
ll G[N], E[N];
int main(){


     cin >> n;
     for(int i = 1; i <= n; ++i){
          ll x, g, e;
          cin >> x >> g >> e;
          p[i] = make_pair(x, make_pair(g, e));
          G[i] = G[i - 1] + g;
          E[i] = E[i - 1] + e;
     }
     ll ans = 0;
     for(int i = 1; i <= n; ++i){
          if(p[i].ss.ss == 1){
               ans = max(ans, p[i].ff);
          }
          for(int j = i + 1; j <= n; ++j){
               if(p[j].ff - p[i].ff == E[j] - E[i - 1]){
                    ans = max(ans, G[j] - G[i - 1]);
               }
          }
     }
     cout << ans;
     return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 644 KB Output isn't correct
2 Halted 0 ms 0 KB -