답안 #403722

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
403722 2021-05-13T11:42:35 Z teehandsome Boat (APIO16_boat) C++11
9 / 100
103 ms 2372 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define endl '\n'
#define INF 1e9+7
#define all(x) x.begin(),x.end()
using namespace std;
using namespace __gnu_pbds;
using ll=long long;
using pii=pair<int,int>;
using ppi=pair<int,pii>;
using oset=tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>;

template<typename T>
void _print(vector<T> x) {cerr<<"{"; for(auto e:x) cerr<<e<<","; cerr<<"}";}
void _print(pii x) {cerr<<"{"<<x.first<<","<<x.second<<"}";}
template<typename T>
void _print(T x) {cerr<<x;}

void dbg() {cerr<<endl;}
template<typename Head,typename... Tail>
void dbg(Head H,Tail... T) {
    _print(H);
    if(sizeof...(T)) cerr<<",";
    else cerr<<"\"]";
    dbg(T...);
}
#define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:[\"",dbg(__VA_ARGS__)

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int md=INF;
ll dp[501][501];

int main () {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i]>>a[i];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(int i=1;i<n;i++) {
        dp[i][i]=1;
        for(int j=0;j<i;j++) {
            if(a[i]>a[j]) {
                for(int k=0;k<=j;k++) {
                    dp[i][j]=(dp[i][j]+dp[j][k])%md;
                }
            }
        }
    }
    ll ans=0;
    for(int i=0;i<n;i++) {
        for(int j=0;j<=i;j++) {
//            cout<<dp[i][j]<<" ";
            ans=(ans+dp[i][j])%md;
        }
//        cout<<endl;
    }
    cout<<ans<<endl;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 2252 KB Output is correct
2 Correct 51 ms 2252 KB Output is correct
3 Correct 50 ms 2252 KB Output is correct
4 Correct 50 ms 2252 KB Output is correct
5 Correct 54 ms 2252 KB Output is correct
6 Correct 96 ms 2268 KB Output is correct
7 Correct 95 ms 2268 KB Output is correct
8 Correct 98 ms 2372 KB Output is correct
9 Correct 97 ms 2268 KB Output is correct
10 Correct 94 ms 2264 KB Output is correct
11 Correct 95 ms 2276 KB Output is correct
12 Correct 97 ms 2252 KB Output is correct
13 Correct 95 ms 2252 KB Output is correct
14 Correct 99 ms 2372 KB Output is correct
15 Correct 103 ms 2264 KB Output is correct
16 Correct 50 ms 2252 KB Output is correct
17 Correct 59 ms 2248 KB Output is correct
18 Correct 48 ms 2248 KB Output is correct
19 Correct 50 ms 2364 KB Output is correct
20 Correct 50 ms 2272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 2252 KB Output is correct
2 Correct 51 ms 2252 KB Output is correct
3 Correct 50 ms 2252 KB Output is correct
4 Correct 50 ms 2252 KB Output is correct
5 Correct 54 ms 2252 KB Output is correct
6 Correct 96 ms 2268 KB Output is correct
7 Correct 95 ms 2268 KB Output is correct
8 Correct 98 ms 2372 KB Output is correct
9 Correct 97 ms 2268 KB Output is correct
10 Correct 94 ms 2264 KB Output is correct
11 Correct 95 ms 2276 KB Output is correct
12 Correct 97 ms 2252 KB Output is correct
13 Correct 95 ms 2252 KB Output is correct
14 Correct 99 ms 2372 KB Output is correct
15 Correct 103 ms 2264 KB Output is correct
16 Correct 50 ms 2252 KB Output is correct
17 Correct 59 ms 2248 KB Output is correct
18 Correct 48 ms 2248 KB Output is correct
19 Correct 50 ms 2364 KB Output is correct
20 Correct 50 ms 2272 KB Output is correct
21 Incorrect 52 ms 2276 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 2252 KB Output is correct
2 Correct 51 ms 2252 KB Output is correct
3 Correct 50 ms 2252 KB Output is correct
4 Correct 50 ms 2252 KB Output is correct
5 Correct 54 ms 2252 KB Output is correct
6 Correct 96 ms 2268 KB Output is correct
7 Correct 95 ms 2268 KB Output is correct
8 Correct 98 ms 2372 KB Output is correct
9 Correct 97 ms 2268 KB Output is correct
10 Correct 94 ms 2264 KB Output is correct
11 Correct 95 ms 2276 KB Output is correct
12 Correct 97 ms 2252 KB Output is correct
13 Correct 95 ms 2252 KB Output is correct
14 Correct 99 ms 2372 KB Output is correct
15 Correct 103 ms 2264 KB Output is correct
16 Correct 50 ms 2252 KB Output is correct
17 Correct 59 ms 2248 KB Output is correct
18 Correct 48 ms 2248 KB Output is correct
19 Correct 50 ms 2364 KB Output is correct
20 Correct 50 ms 2272 KB Output is correct
21 Incorrect 52 ms 2276 KB Output isn't correct
22 Halted 0 ms 0 KB -