답안 #86619

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86619 2018-11-27T03:56:40 Z 1Khan 금 캐기 (IZhO14_divide) C++14
17 / 100
166 ms 3036 KB
// In the name of GOD

#include <bits/stdc++.h>

using namespace std;

#define good exit(0);
#define nl endl
#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 pb push_back
#define bb begin()
#define ee end()
#define ff first
#define ss second
#define ll long long
#define db double
#define pii pair<int, int>

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

int n, m;
ll a[N], b[N], c[N];
ll ans;
int main(){

     cin >> n;
     for(int i = 1; i <= n; ++i){
          ll q, w, e;
          cin >> q >> w >> e;
          a[i] = q;
          b[i] = b[i - 1] + w;
          c[i] = c[i - 1] + e;

     }
     for(int i = 1; i <= n; ++i){
          ans = max(ans, b[i] - b[i - 1]);
          int l = i + 1, r = n;
          while(l <= r){
               int m = (l + r) / 2;
               if(a[m] - a[i] <= c[m] - c[i -1]){
                    ans = max(ans, b[m] - b[i - 1]);
                    l = m + 1;
               } else{
                    r = m - 1;
               }
          }
     }
     cout << ans << nl;
     return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 472 KB Output is correct
3 Correct 2 ms 532 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
5 Correct 2 ms 552 KB Output is correct
6 Correct 2 ms 584 KB Output is correct
7 Correct 2 ms 588 KB Output is correct
8 Correct 3 ms 612 KB Output is correct
9 Correct 2 ms 616 KB Output is correct
10 Correct 2 ms 620 KB Output is correct
11 Correct 2 ms 624 KB Output is correct
12 Correct 2 ms 628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 632 KB Output is correct
2 Correct 2 ms 660 KB Output is correct
3 Incorrect 2 ms 660 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 660 KB Output is correct
2 Correct 11 ms 804 KB Output is correct
3 Correct 14 ms 860 KB Output is correct
4 Correct 63 ms 1848 KB Output is correct
5 Correct 74 ms 1896 KB Output is correct
6 Correct 166 ms 2980 KB Output is correct
7 Correct 118 ms 3036 KB Output is correct
8 Correct 119 ms 3036 KB Output is correct
9 Correct 114 ms 3036 KB Output is correct
10 Incorrect 118 ms 3036 KB Output isn't correct
11 Halted 0 ms 0 KB -