# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
107755 | 2019-04-25T16:36:01 Z | Just_Solve_The_Problem | Boat (APIO16_boat) | C++11 | 3 ms | 412 KB |
#include <bits/stdc++.h> #define ll long long using namespace std; const int N = (int)507; const int mod = (int)1e9 + 7; int add(int a, int b) { return (a + b) % mod; } int mul(int a, int b) { return (a * 1LL * b) % mod; } int n; int a[N], b[N]; struct fen { int tree[N]; fen() { memset(tree, 0, sizeof tree); } void upd(int pos, int val) { while (pos < N) { tree[pos] = add(tree[pos], val); pos = pos | pos + 1; } } int get(int r) { int res = 0; while (r >= 0) { res = add(res, tree[r]); r = (r & r + 1) - 1; } return res; } }; fen tr; main() { scanf("%d", &n); vector < int > vec; vec.push_back(-1e9); for (int i = 1; i <= n; i++) { scanf("%d %d", &a[i], &b[i]); vec.push_back(a[i]); } sort(vec.begin(), vec.end()); for (int i = 1; i <= n; i++) { a[i] = lower_bound(vec.begin(), vec.end(), a[i]) - vec.begin(); } tr.upd(0, 1); for (int i = 1; i <= n; i++) { tr.upd(a[i], tr.get(a[i] - 1)); } cout << add(tr.get(N - 1), mod - 1); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 316 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 256 KB | Output is correct |
8 | Correct | 3 ms | 256 KB | Output is correct |
9 | Correct | 3 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 412 KB | Output is correct |
11 | Correct | 3 ms | 284 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 256 KB | Output is correct |
14 | Correct | 3 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 256 KB | Output is correct |
16 | Correct | 3 ms | 256 KB | Output is correct |
17 | Correct | 3 ms | 256 KB | Output is correct |
18 | Correct | 3 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 256 KB | Output is correct |
20 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 316 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 256 KB | Output is correct |
8 | Correct | 3 ms | 256 KB | Output is correct |
9 | Correct | 3 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 412 KB | Output is correct |
11 | Correct | 3 ms | 284 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 256 KB | Output is correct |
14 | Correct | 3 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 256 KB | Output is correct |
16 | Correct | 3 ms | 256 KB | Output is correct |
17 | Correct | 3 ms | 256 KB | Output is correct |
18 | Correct | 3 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 256 KB | Output is correct |
20 | Correct | 2 ms | 384 KB | Output is correct |
21 | Incorrect | 3 ms | 256 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 316 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 256 KB | Output is correct |
8 | Correct | 3 ms | 256 KB | Output is correct |
9 | Correct | 3 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 412 KB | Output is correct |
11 | Correct | 3 ms | 284 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 3 ms | 256 KB | Output is correct |
14 | Correct | 3 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 256 KB | Output is correct |
16 | Correct | 3 ms | 256 KB | Output is correct |
17 | Correct | 3 ms | 256 KB | Output is correct |
18 | Correct | 3 ms | 256 KB | Output is correct |
19 | Correct | 2 ms | 256 KB | Output is correct |
20 | Correct | 2 ms | 384 KB | Output is correct |
21 | Incorrect | 3 ms | 256 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |