답안 #170231

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
170231 2019-12-24T09:52:47 Z beso123 금 캐기 (IZhO14_divide) C++14
17 / 100
221 ms 3056 KB
#include <bits/stdc++.h>
#define int long long
#define pii pair<int, pair<int,int> >
#define x first
#define y second.first
#define z second.second
using namespace std;
int n;
pii a[100005];
main(){
cin>>n;
for(int k=1;k<=n;k++){
    int a1,b,c;
    cin>>a1>>b>>c;
   a[k]={a1,{b,c}};
}
int l=1;
int ans=a[1].y,sc=a[1].z;
int pas=ans;
for(int r=1;r<=n;r++){
  if(r!=1){
    ans+=a[r].y;
    sc+=a[r].z;
  }
  while(l<=r && sc<a[r].x-a[l].x){
    ans-=a[l].y;
    sc-=a[l].z;
    l++;
  }
  pas=max(pas,ans);
}
cout<<pas;
return 0;
}

Compilation message

divide.cpp:10:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 368 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 3 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 504 KB Output is correct
2 Correct 14 ms 632 KB Output is correct
3 Correct 18 ms 760 KB Output is correct
4 Correct 85 ms 1784 KB Output is correct
5 Correct 102 ms 1784 KB Output is correct
6 Correct 221 ms 2968 KB Output is correct
7 Correct 168 ms 3028 KB Output is correct
8 Correct 155 ms 3056 KB Output is correct
9 Correct 143 ms 2928 KB Output is correct
10 Incorrect 144 ms 2936 KB Output isn't correct
11 Halted 0 ms 0 KB -