Submission #124197

# Submission time Handle Problem Language Result Execution time Memory
124197 2019-07-02T16:00:05 Z AyaBenSaad Boat (APIO16_boat) C++14
9 / 100
3 ms 376 KB
#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

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 time Memory Grader output
1 Correct 3 ms 252 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 256 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 296 KB Output is correct
19 Correct 3 ms 256 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 252 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 256 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 296 KB Output is correct
19 Correct 3 ms 256 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Incorrect 3 ms 376 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 252 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 256 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 256 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 3 ms 376 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 3 ms 296 KB Output is correct
19 Correct 3 ms 256 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Incorrect 3 ms 376 KB Output isn't correct
22 Halted 0 ms 0 KB -