Submission #1047200

#TimeUsernameProblemLanguageResultExecution timeMemory
1047200EntityPlanttBouquet (EGOI24_bouquet)C++17
24 / 100
18 ms1248 KiB
#include <iostream> using namespace std; const int N = 2e5 + 5; int dp[N]; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); bool subt1 = true; int n, rd; cin >> n; dp[0] = 1; for (int i = 0, l, r; i < n; i++) { cin >> l >> r; if (l == r) { if (!i) rd = l; else if (rd != l) subt1 = false; } else subt1 = false; if (i) dp[i] = dp[i - 1]; if (i > l) dp[i] = max(dp[i], dp[i - l - 1] + 1); } if (subt1) cout << (n + rd) / (rd + 1); else cout << dp[n - 1]; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:24:36: warning: 'rd' may be used uninitialized in this function [-Wmaybe-uninitialized]
   24 |  if (subt1) cout << (n + rd) / (rd + 1);
      |                                ~~~~^~~~
#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...