답안 #458906

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
458906 2021-08-08T06:52:56 Z Fidisk Boat (APIO16_boat) C++14
0 / 100
2 ms 332 KB
#include <bits/stdc++.h>
using namespace std;

#define oo 1e9
#define fi first
#define se second
#define sp(iiii) setprecision(iiii)
#define IO ios_base::sync_with_stdio(false); cin.tie(0)
#define ms(aaaa,xxxx) memset(aaaa,xxxx,sizeof(aaaa))
#define cntbit(xxxx) __builtin_popcount(xxxx)
#define getbit(xxxx,aaaa) (((xxxx)>>(aaaa-1))&1)

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef pair<pair<int,int>,pair<int,int>> piiii;
typedef pair<long long,long long> pll;
typedef pair<pair<long long,long long>,long long> plll;
typedef pair<pair<long long,long long>,pair<long long,long long>> pllll;
typedef pair<pair<long long,long long>,bool> pllb;
typedef pair<long double,long double> pld;
typedef pair<pair<long double,long double>,long double> plld;
typedef pair<long double,long long> pdl;

const ll base=361;
const ll mod=1e9+7;
const ll mod2=1e9;
const ld eps=1e-3;
const ld eps2=1e-7;
const ll maxn=3e5+9;
const ll maxsize=6e5+29;
const ld pi=acos(-1);
const ll delta=1e5+7;
const int dx[4]={1,-1,0,0};
const int dy[4]={0,0,1,-1};

const int dxkn[8]={1,1,2,2,-1,-1,-2,-2};
const int dykn[8]={2,-2,1,-1,2,-2,1,-1};
const int dxki[8]={1,1,1,0,0,-1,-1,-1};
const int dyki[8]={1,0,-1,1,-1,1,0,-1};

ll n,i,a[509],b[509];

void solve_sub1() {
    ll f[509][2];
    f[0][0]=1;
    f[0][1]=0;
    for (int ii=1;ii<=n;ii++) {
        for (int ij=0;ij<ii;ij++) {
            f[ii][0]=(f[ij][0]+f[ii][0])%mod;
            f[ii][1]=(f[ii][1]+f[ij][0])%mod;
            if (a[ii]>a[ij]) {
                f[ii][1]=(f[ii][1]+f[ij][1])%mod;
            }
        }
    }
    cout<<f[n][1]<<'\n';
}

bool sub1() {
    for (ll ii=1;ii<=n;ii++) {
        if (a[ii]!=b[ii]) {
            return false;
        }
    }
    return true;
}

int main(){
    IO;
    cin>>n;
    for (i=1;i<=n;i++) {
        cin>>a[i]>>b[i];
    }
    if (sub1()) {
        solve_sub1();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -