제출 #126415

#제출 시각아이디문제언어결과실행 시간메모리
126415shafinalamBoat (APIO16_boat)C++14
9 / 100
4 ms380 KiB
#include <bits/stdc++.h>

using namespace std;
const int mxn = 1e5+5;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<int,int>pii;
#define ff first
#define ss second

pii arr[mxn];
int dp[505];
int n;

int solve(int pos)
{
    if(pos>=n) return 0;
    if(dp[pos]!=-1) return dp[pos];

    int ret = 0;
    for(int i = pos+1; i <= n; i++)
        if(arr[i].ff>arr[pos].ff) ret = (ret+solve(i)+1)%mod;
    return dp[pos] = ret%mod;
}
int main()
{
    scanf("%d", &n);

    for(int i = 1; i <= n; i++)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        arr[i] = make_pair(a, b);
    }
    memset(dp, -1, sizeof dp);
    int ans = solve(0)%mod;
    printf("%d\n", ans);
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

boat.cpp: In function 'int main()':
boat.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
boat.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...