제출 #1087349

#제출 시각아이디문제언어결과실행 시간메모리
1087349SulABouquet (EGOI24_bouquet)C++17
24 / 100
24 ms4948 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define bitcount __builtin_popcountll using namespace std; using namespace __gnu_pbds; using namespace chrono; int main() { ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); int n; cin >> n; int l[n+1], r[n+1]; for (int i = 1; i <= n; cin >> l[i] >> r[i++]); int dp[n+1] = {}; for (int i = 1; i <= n; i++) { dp[i] = max({ dp[i-1], dp[ max(0, i - l[i] - 1) ] + 1 }); } cout << dp[n]; }

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

Main.cpp: In function 'int main()':
Main.cpp:15:47: warning: operation on 'i' may be undefined [-Wsequence-point]
   15 |     for (int i = 1; i <= n; cin >> l[i] >> r[i++]);
      |                                              ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...