Submission #48371

# Submission time Handle Problem Language Result Execution time Memory
48371 2018-05-12T09:25:42 Z temurbek_khujaev Boat (APIO16_boat) C++17
9 / 100
3 ms 700 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) (int((x.size())))
#define fi first
#define se second

typedef long double 	ld;
typedef long long 		ll;
typedef vector<int> 	VI;
typedef pair<int, int>	PII;
typedef pair<ll, ll> 	PLL;
typedef vector<ll>		VL;
typedef vector<PLL> 	VPL;
typedef vector<PII> 	VPI;
typedef tree <int, null_type, less<int> ,rb_tree_tag ,tree_order_statistics_node_update > ordered_set;

#define REP(i,a,n) for (int i = a; i < n; i++)
#define PER(i,a,n) for (int i = n-1; i >= a; i--)

#define dbb(x) cout << #x << " = " << x << "\t";
#define db(x)        { dbb(x); cout << endl; }
#define db2(x,y)     { dbb(x); dbb(y); cout << endl; }
#define db3(x,y,z)   { dbb(x); dbb(y); dbb(z); cout << endl; }

template <typename t1, typename t2> inline bool upmax(t1 &a, t2 b) { if (a<(t1)b) { a = (t1)b; return true; } else return false; }
template <typename t1, typename t2> inline bool upmin(t1 &a, t2 b) { if (a>(t1)b) { a = (t1)b; return true; } else return false; }
template <typename T> inline bool pal(T &x){ int n = SZ(x); REP(i, 0, n / 2) { if (x[i] != x[n - i - 1]) return 0; } return 1; }
template <typename T> inline T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template <typename T> inline T lcm(T a, T b) { return a*(b / gcd(a, b)); }
template <typename T> inline T sqr(T a) { return a*a; }

int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };

const int INF = 1000000404;
const ll  LINF = 4000000000000000404ll;
const ll  MOD = 1000000007ll;
const ld  PI = acos(-1.0);
const ld  EPS = 1e-9;

ll powmod(ll a, ll b) {
	ll res = 1; a %= MOD; assert(b >= 0);
	for (; b; b >>= 1) { if (b & 1) res = res*a%MOD; a = a*a%MOD; }return res;
}

int SQ = 404;
int timer = 0;

#define N 555

int a[N];
int b[N];
ll comb[N];

void solve() {
    int n;
    cin >> n;

    REP (i, 1, n + 1) {
        cin >> a[i] >> b[i];
    }
    ll ans = 0;
    REP (i, 1, n + 1) {
        ll s = 1;
        REP(j, 1, i) {
            if (a[j] < a[i]) {
                s += comb[j];
                s %= MOD;
            }
        }
        comb[i] = s;
        ans = (ans + s) % MOD;
    }
    cout << ans << endl;


}

int main()
{
  //  freopen("INPUT.in","r",stdin);
  //  freopen("OUTPUT.out","w",stdout);

    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int t = 1;
    //cin >> t;

    while (t--) {

        solve();

    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 444 KB Output is correct
3 Correct 2 ms 444 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 3 ms 700 KB Output is correct
9 Correct 2 ms 700 KB Output is correct
10 Correct 3 ms 700 KB Output is correct
11 Correct 2 ms 700 KB Output is correct
12 Correct 3 ms 700 KB Output is correct
13 Correct 3 ms 700 KB Output is correct
14 Correct 2 ms 700 KB Output is correct
15 Correct 2 ms 700 KB Output is correct
16 Correct 2 ms 700 KB Output is correct
17 Correct 2 ms 700 KB Output is correct
18 Correct 2 ms 700 KB Output is correct
19 Correct 2 ms 700 KB Output is correct
20 Correct 2 ms 700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 444 KB Output is correct
3 Correct 2 ms 444 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 3 ms 700 KB Output is correct
9 Correct 2 ms 700 KB Output is correct
10 Correct 3 ms 700 KB Output is correct
11 Correct 2 ms 700 KB Output is correct
12 Correct 3 ms 700 KB Output is correct
13 Correct 3 ms 700 KB Output is correct
14 Correct 2 ms 700 KB Output is correct
15 Correct 2 ms 700 KB Output is correct
16 Correct 2 ms 700 KB Output is correct
17 Correct 2 ms 700 KB Output is correct
18 Correct 2 ms 700 KB Output is correct
19 Correct 2 ms 700 KB Output is correct
20 Correct 2 ms 700 KB Output is correct
21 Incorrect 2 ms 700 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 700 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 444 KB Output is correct
3 Correct 2 ms 444 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 3 ms 700 KB Output is correct
9 Correct 2 ms 700 KB Output is correct
10 Correct 3 ms 700 KB Output is correct
11 Correct 2 ms 700 KB Output is correct
12 Correct 3 ms 700 KB Output is correct
13 Correct 3 ms 700 KB Output is correct
14 Correct 2 ms 700 KB Output is correct
15 Correct 2 ms 700 KB Output is correct
16 Correct 2 ms 700 KB Output is correct
17 Correct 2 ms 700 KB Output is correct
18 Correct 2 ms 700 KB Output is correct
19 Correct 2 ms 700 KB Output is correct
20 Correct 2 ms 700 KB Output is correct
21 Incorrect 2 ms 700 KB Output isn't correct
22 Halted 0 ms 0 KB -