Submission #1238688

#TimeUsernameProblemLanguageResultExecution timeMemory
1238688JerBouquet (EGOI24_bouquet)C++20
24 / 100
20 ms1920 KiB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 2e5 + 5;
int l[MAXN], r[MAXN];
int n;
int dp[MAXN];

int main()
{
    scanf("%d", &n);

    for (int i = 0; i < n; i++)
        scanf("%d%d", &l[i], &r[i]);

    int res = 1, curr = 0;
    for (int i = 0; i < n; i++)
    {
        if (curr < i - l[i])
            res++, curr = i;
    }

    printf("%d\n", res);

    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%d%d", &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...