| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1111458 | gelastropod | Trains (BOI24_trains) | C++14 | 44 ms | 5308 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<int> tree;
void upd(int n, int x)
{
    while (n < tree.size())
    {
        tree[n] += x;
        tree[n] %= 1000000007;
        n += n & (-n);
    }
}
int qry(int a)
{
    if (a == 0)
        return 0;
    if (a >= tree.size())
        return qry(tree.size() - 1);
    int ans = 0;
    while (a > 0)
    {
        ans += tree[a];
        ans %= 1000000007;
        a -= a & (-a);
    }
    return ans;
}
signed main()
{
    int N, a, b;
    cin >> N;
    tree = vector<int>(N + 1, 0);
    vector<pair<int, int>> vals;
    for (int i = 0; i < N; i++)
    {
        cin >> a >> b;
        vals.push_back({a, b});
    }
    for (int i = N - 1; i >= 0; i--)
    {
        if (i + 1 >= N)
            upd(i + 1, 1);
        else
            upd(i + 1, (1 + qry(i + 1 + vals[i].second) - qry(i)) % 1000000007);
    }
    cout << qry(1) << '\n';
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
