Submission #340618

#TimeUsernameProblemLanguageResultExecution timeMemory
340618beksultan04금 캐기 (IZhO14_divide)C++14
48 / 100
1082 ms2560 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
const int N = 1e6+12,INF=1e9+7;
ll q[N],x[N],g[N],d[N];

main(){
    int n,m,i,j;
    ll ans=0;
    scan1(n)
    for (i=1;i<=n;++i){
        scanlll(x[i],g[i],d[i])
    }
    for (i=1;i<=n;++i){
        ll e=d[i],sum=g[i];
        ans = max(ans,sum);
        for (j=i+1;j<=n;++j){
            e += d[j];
            sum += g[j];
            if (e >= x[j]-x[i]){
                ans = max(ans,sum);
            }
        }
    }
    cout <<ans;


}






Compilation message (stderr)

divide.cpp:26:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   26 | main(){
      |      ^
divide.cpp: In function 'int main()':
divide.cpp:27:11: warning: unused variable 'm' [-Wunused-variable]
   27 |     int n,m,i,j;
      |           ^
divide.cpp:14:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 | #define scan1(a) scanf("%d",&a);
      |                  ~~~~~^~~~~~~~~
divide.cpp:29:5: note: in expansion of macro 'scan1'
   29 |     scan1(n)
      |     ^~~~~
divide.cpp:13:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 | #define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
      |                        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
divide.cpp:31:9: note: in expansion of macro 'scanlll'
   31 |         scanlll(x[i],g[i],d[i])
      |         ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...