Submission #124197

#TimeUsernameProblemLanguageResultExecution timeMemory
124197AyaBenSaadBoat (APIO16_boat)C++14
9 / 100
3 ms376 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
const int MOD = 1e9 + 7;
const int M = 5e2 + 2;
int n, t[M];
long long dp[M];
 
 
int main () {
  scanf ("%d", &n);
  int a;
  for (int i = 1; i <= n; i++) scanf ("%d %d", &t[i], &a);
  for (int i = 1; i <= n; i++) {
    dp[i] = 1;
    for (int j = 1; j <= i-1; j++)
        if (t[j] < t[i])
            dp[i] = (dp[i] + dp[j]) % MOD;  
    }
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        ans = (ans + dp[i]) % MOD;
    }
    printf("%lld\n", ans);
} 

Compilation message (stderr)

boat.cpp: In function 'int main()':
boat.cpp:12:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf ("%d", &n);
   ~~~~~~^~~~~~~~~~
boat.cpp:14:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for (int i = 1; i <= n; i++) scanf ("%d %d", &t[i], &a);
                                ~~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...