Submission #124164

# Submission time Handle Problem Language Result Execution time Memory
124164 2019-07-02T15:17:08 Z AyaBenSaad Boat (APIO16_boat) C++14
0 / 100
4 ms 1272 KB
#include <bits/stdc++.h>
 
using namespace std;
 
const int M = 5e2 + 2;
int n, t[M], dp[M][M];
 
int solve (int id = 1, int per = 0) {
    if (id == 1+n) return 1;
    if (dp[id][per] != -1) return dp[id][per];
    int x = (t[id] > t[per] ? solve (id + 1, id) : 0);
    dp[id][per] = solve (id + 1, per) + x;
    return dp[id][per];
}
 
int main () {
  scanf ("%d", &n);
  int a;
  for (int i = 1; i <= n; i++) scanf ("%d %d", &t[i], &a);
  t[0] = -2e9;
  memset (dp, -1, sizeof dp);
  printf ("%d\n", solve()-1);
} 

Compilation message

boat.cpp: In function 'int main()':
boat.cpp:17:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf ("%d", &n);
   ~~~~~~^~~~~~~~~~
boat.cpp:19: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 Incorrect 4 ms 1272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1272 KB Output isn't correct
2 Halted 0 ms 0 KB -