제출 #91084

#제출 시각아이디문제언어결과실행 시간메모리
91084Hideo금 캐기 (IZhO14_divide)C++14
48 / 100
1076 ms2916 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 1e5 + 7; const int INF = 1e9 + 7; ll x[N], g[N], d[N]; int n; ll mx, pre[N], prg[N]; main(){ cin >> n; for (int i = 1; i <= n; i++){ scanf("%lld%lld%lld", &x[i], &g[i], &d[i]); mx = max(g[i], mx); prg[i] = prg[i - 1] + g[i]; pre[i] = pre[i - 1] + d[i]; } for (int i = 1; i <= n; i++){ for (int j = i + 1; j <= n; j++){ if (pre[j] - pre[i - 1] >= x[j] - x[i]){ mx = max (prg[j] - prg[i - 1], mx); } } } cout << mx; }

컴파일 시 표준 에러 (stderr) 메시지

divide.cpp:12:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
divide.cpp: In function 'int main()':
divide.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld%lld", &x[i], &g[i], &d[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...