QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#484823#8649. Escape Route 2Qwerty1232#0 30ms9144kbC++231.7kb2024-07-20 02:07:162024-07-20 02:07:17

Judging History

你现在查看的是最新测评结果

  • [2024-07-20 02:07:17]
  • 评测
  • 测评结果:0
  • 用时:30ms
  • 内存:9144kb
  • [2024-07-20 02:07:16]
  • 提交

answer

#include <bits/stdc++.h>

int32_t main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n, T;
    std::cin >> n >> T;
    std::vector<std::vector<std::pair<int, int>>> fuck(n - 1);
    for (int i = 0; i < n - 1; i++) {
        int k;
        std::cin >> k;
        fuck[i].resize(k);
        for (auto& [u, v] : fuck[i]) {
            std::cin >> u >> v;
        }
        std::sort(fuck[i].begin(), fuck[i].end());
    }

    int q;
    std::cin >> q;
    std::vector<std::array<int, 3>> quer(q);
    for (int i = 0; i < q; i++) {
        auto& [l, r, id] = quer[i];
        std::cin >> l >> r;
        l--;
        r--;
        id = i;
    }

    std::vector<int64_t> ans(q, -1);
    for (int i = 0; i < q; i++) {
        auto [l, r, id] = quer[i];

        int64_t min = 1e18;
        for (int j = 0; j < fuck[l].size(); j++) {
            int d = 0, t = fuck[l][j].second;
            for (int p = l + 1; p < r; p++) {
                int mn = T;
                for (int j2 = 0; j2 < fuck[p].size(); j2++) {
                    auto [a, b] = fuck[p][j2];
                    assert(b != T);
                    if (t <= a && b < mn) {
                        mn = b;
                    }
                }
                if (mn == T) {
                    d++;
                    t = 0;
                    p--;
                    continue;
                } else {
                    t = mn;
                }
            }
            min = std::min(min, d * int64_t(T) + t - fuck[l][j].first);
        }
        ans[id] = min;
    }

    for (int i = 0; i < q; i++) {
        std::cout << ans[i] << " \n"[i == q - 1];
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 30ms
memory: 9144kb

input:

2 1000000000
1
359893566 955414858
300000
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 ...

output:

595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 595521292 ...

result:

wrong answer 1st lines differ - expected: '595521292', found: '595521292 595521292 595521292 ...2 595521292 595521292 595521292'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Time Limit Exceeded

Test #39:

score: 0
Time Limit Exceeded

input:

301 1000000000
300
863578477 865166395
261293731 262628986
290161866 292035987
31029640 32135494
288138979 289416854
321254857 322352244
163393949 166291828
897880953 899050317
840019366 842900569
100947276 102350870
520716771 522094941
820182602 822928836
766708508 769688128
727827782 728874133
740...

output:


result:


Subtask #6:

score: 0
Skipped

Dependency #1:

0%