답안 #124197

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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);
                                ~~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -