제출 #91054

#제출 시각아이디문제언어결과실행 시간메모리
91054Aydarov03금 캐기 (IZhO14_divide)C++14
0 / 100
24 ms704 KiB
#include <bits/stdc++.h> #define int long long #define fr first #define sc second using namespace std; pair<int , pair<int,int> > p[100005]; bool used[100005]; int ans; main() { int n; cin >> n; for(int i = 1; i <= n; i++) { scanf("%d%d%d" , &p[i].fr , &p[i].sc.fr , &p[i].sc.sc); } for(int now = 1; now <= n; now++) { int gold = 0 , place = p[now].fr; for(int i = now; i <= n; i++) { // cout << place << " " << gold << endl; gold += p[i].sc.fr; if( !used[i] ) { if( place + ( p[i].sc.sc - (place - p[i].fr) ) >= p[i+1].fr ) { place += ( p[i].sc.sc - (place - p[i].fr) ); used[i] = 1; continue; } else if( place + ( p[i].sc.sc - (place - p[i].fr) ) + p[i+1].sc.sc >= p[i+1].fr ) { place = p[i+1].fr; used[i] = used[i+1] = 1; continue; } else break; } else { if( p[i+1].fr - p[i+1].sc.sc <= place ) { used[i+1] = 1; place = p[i+1].fr; } else break; } } ans = max( ans , gold ); memset( used , 0 , sizeof(used) ); } cout << ans; }

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

divide.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
divide.cpp: In function 'int main()':
divide.cpp:18:62: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
         scanf("%d%d%d" , &p[i].fr , &p[i].sc.fr , &p[i].sc.sc);
                                                              ^
divide.cpp:18:62: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
divide.cpp:18:62: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'long long int*' [-Wformat=]
divide.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d" , &p[i].fr , &p[i].sc.fr , &p[i].sc.sc);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...