답안 #344642

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
344642 2021-01-06T06:57:40 Z pragmatist 금 캐기 (IZhO14_divide) C++14
17 / 100
1 ms 364 KB
// turmak-_-
#include<bits/stdc++.h>

#define all(v) v.begin(),v.end()
#define sz(a) a.size()
#define nl "\n"
#define IOI return 0;
#define pb push_back
#define ppb pop_back()
#define int long long
#define ull unsigned long long
#define ld long double
#define IOS ios_base :: sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
#define pii pair<int,int>
#define X first
#define Y second


using namespace std;
const int N = (int)1e5 + 7 ;
const int MOD = (int)998244353;
const int INF = (int)1e18 + 7;
const int inf = (int)1e9 + 7;

pii dx[] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

int x[N],g[N],d[N],p[N],p1[N];

void solve() {
    int n;
    cin>>n;
    int mx = 0;
    for(int i=1; i<=n; ++i) {
        cin>>x[i]>>g[i]>>d[i];
        if(d[i]>=1) mx = max(mx, g[i]);
        p[i]=p[i-1] + g[i];
        p1[i]=p1[i-1] + d[i];
    }
    for(int i=1; i<=n; ++i) {
        for(int j=i+1; j<=n; ++j) {
            if(x[j]-x[i]<=p1[j]-p1[i-1]) {
                mx = max(mx, p[j]-p[i-1]);
            } else {
                break;
            }
        }
    }
    cout<<mx;
}
main() {
    IOS
    //freopen("cinema.in", "r", stdin);
    //freopen("cinema.out", "w", stdout);
    int tt=1;
    //  cin>>tt;
    while(tt--) {
        solve();
    }
    IOI
}

Compilation message

divide.cpp:50:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main() {
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Halted 0 ms 0 KB -