답안 #100518

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100518 2019-03-12T02:54:27 Z 1Khan 금 캐기 (IZhO14_divide) C++14
0 / 100
19 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;
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;
}
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -