An Advanced Algorithmic Assessment 1


posted on Dec. 7, 2025, 6:51 p.m.

Aloha all!

After an ambitious and arduous assembly, an Advanced Algorithmic Assessment appears!

The contest will begin on December 18th, 2025 00:00 EST and will last one week. Participants will have a 3 hour window to solve 6 problems.

The contest is rated for participants with a rating less than 2800.

For more information, please visit the contest page.

Awsome activities and amazing adventures await!


Comments


  • 0
    wasif_shahzad  commented on Dec. 25, 2025, 6:08 a.m.

    can someone help me figure out what's wrong in this for SubTask 2 in Problem 3?

    void solve2() {
        int n;
        cin >> n;
        vector<int> a(n + 1, 1);
        for(int i = 1; i <= n; i++) {
            cin >> a[i];
        }
        auto cmp = [&] (auto x, auto y) -> bool {
            return x.second - x.first < y.second - y.first;
        };
        set<pair<int, int>, decltype(cmp)> breakable(cmp);
        set<pair<int, int>> single;
        vector<int> ans(n, -1);
        breakable.insert({0, n - 1});
        if(a[1] != 1) {
            cout << -1 << '\n';
            return;
        }
        int cur = 1;
        for(int i = 2; i <= n; i++) {
            if(a[i] > a[i - 1]) {
                // need to break
                while(cur < a[i]) {
                    if(breakable.empty()) {
                        cout << -1 << '\n';
                        return;
                    }
                    auto [l, r] = *breakable.begin();
                    breakable.erase(*breakable.begin());
                    int left = -1;
                    for(int j = l + 1; j <= r; j += 2) {
                        ans[j] = i - 1;
                        single.insert({j - 1, j - 1});
                        cur++;
                        if(cur == a[i]) {
                            left = j + 1;
                            break;
                        }
                    }
                    l = left;
                    if(r - l > 2) {
                        breakable.insert({l, r});
                    } else {
                        single.insert({l, r});
                    }
                }
            } else {
                // need to remove
                while(cur > a[i]) {
                    if(single.empty()) {
                        while(breakable.size()) {
                            auto [l, r] = *breakable.begin();
                            for(int j = l; j <= r; j++) {
                                ans[j] = i - 1;
                            }
                            breakable.erase(*breakable.begin());
                            cur--;
                            if(cur == a[i]) break;
                        }
                    } else if(single.size()) {
                        while(single.size()) {
                            auto [l, r] = *single.begin();
                            for(int j = l; j <= r; j++) {
                                ans[j] = i - 1;
                            }
                            single.erase(*single.begin());
                            cur--;
                            if(cur == a[i]) break;
                        }
                    } else break;
                }
                if(cur > a[i]) {
                    cout << -1 << '\n';
                    return;
                }
            }
        }
        for(int i = 0; i < n; i++) {
            if(ans[i] == -1) ans[i] = n;
        }
        for(int i = 0; i < n; i++) cout << ans[i] << " ";
        cout << "\n";
    }
    

    • 4
      thomas_li  commented on Dec. 25, 2025, 4:03 p.m.

      the answer


      • 0
        wasif_shahzad  commented on Dec. 25, 2025, 4:05 p.m.

        bruh. I meant what's the mistake :sob: