Submission #1248059

#TimeUsernameProblemLanguageResultExecution timeMemory
1248059mosesmayerBouquet (EGOI24_bouquet)C++20
28 / 100
3095 ms2356 KiB
#include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define eb emplace_back using namespace std; typedef long long LL; typedef pair<int,int> pii; typedef vector<int> vi; template<class T> inline T re(){ T N = 0; char c = getchar(); bool neg = 0; for (; c < '0' || c > '9'; c = getchar()) neg |= c == '-'; for (; c >= '0' && c <= '9'; c = getchar()) N = (N<<3)+(N<<1) + c - '0'; return neg ? -N : N; } const int MX = 2e5; int n; int l[MX + 5], r[MX + 5]; int dp[MX + 5]; int main() { n = re<int>(); for (int i = 1; i <= n; i++) { l[i] = re<int>(); r[i] = re<int>(); } dp[0] = 0; int mx = 0; for (int i = 1; i <= n; i++) { dp[i] = 1; for (int j = i - l[i] - 1; j > 0; --j) { if (j + r[j] < i) dp[i] = max(dp[i], dp[j] + 1); } mx = max(mx, dp[i]); } printf("%lld\n", mx); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:41:16: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int' [-Wformat=]
   41 |     printf("%lld\n", mx);
      |             ~~~^     ~~
      |                |     |
      |                |     int
      |                long long int
      |             %d
#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...