Submission #100516

# Submission time Handle Problem Language Result Execution time Memory
100516 2019-03-12T02:44:56 Z 1Khan Divide and conquer (IZhO14_divide) C++14
0 / 100
14 ms 512 KB
// 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;
int g[N], e[N];
int a[N];
int 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
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -