Submission #1087351

#TimeUsernameProblemLanguageResultExecution timeMemory
1087351SulABouquet (EGOI24_bouquet)C++17
28 / 100
3096 ms3420 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], r[n]; for (int i = 0; i < n; cin >> l[i] >> r[i++]); int dp[n]; dp[0] = 1; for (int i = 1; i < n; i++) { dp[i] = 1; for (int j = 0; j < i; j++) if (i > j + r[j] && j < i - l[i]) { dp[i] = max(dp[i], dp[j] + 1); } } cout << *max_element(dp, dp + n); }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:15:46: warning: operation on 'i' may be undefined [-Wsequence-point]
   15 |     for (int i = 0; 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...