QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#859772#9915. General Symmetryucup-team6275Compile Error//C++201.7kb2025-01-17 23:16:062025-01-17 23:16:07

Judging History

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

  • [2025-01-17 23:16:07]
  • 评测
  • [2025-01-17 23:16:06]
  • 提交

answer

#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <deque>
#include <set>
#include <random>
#include <cassert>
#include <chrono>
#include <bitset>

using namespace std;
const int MAXN = 2e5 + 10;
const int MAXA = 1000;

bitset<MAXN> bad_pos[MAXA];

void solve() {
    int n, k;
    cin >> n >> k;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i]; --a[i];
    }
    vector <int> ans(2 * n - 1);
    for (int val = 0; val < MAXA; ++val) {
        for (int i = 0; i < n; ++i) {
            if (abs(a[i] - val) > k) bad_pos[val].set(i);
        }
    }

    bitset<MAXN> cur_positions;
    bitset<MAXN> tmp;
    for (int i = 0; i < n; ++i) {
        ans[2 * i] = 2 * min(i + 1, n - i) - 1;
    }
    for (int i = 0; i < n - 1; ++i) {
        ans[2 * i + 1] = 2 * min(i + 1, n - i - 1);
    }

    for (int r = 0; r < n; ++r) {
        cur_positions.set(r);
        if (r) cur_positions.set(r - 1);

        tmp = cur_positions & bad_pos[a[r]];
        int cha = tmp._Find_first();

        while (cha != MAXN) {
            ans[cha + r] = r - cha + 1;
            cur_positions.reset(cha);
            cha = tmp.Find_next(cha);
        }

        cur_positions <<= 1;
    }

    for (int i = 0; i < n; ++i) cout << ans[2 * i] << " ";
    for (int i = 0; i < n - 1; ++i) cout << ans[2 * i + 1] << " ";
}

signed main() {
    if (1) {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    int t = 1;
    while (t--) {
        solve();
    }

    return 0;
}

/*
5 7
1 2
1 3
2 4
2 5
A 1 4 2
A 3 5 2
D 1 4
D 2 3
D 2 1
A 5 5 10
D 5 100
 */

Details

answer.code: In function ‘void solve()’:
answer.code:54:23: error: ‘class std::bitset<200010>’ has no member named ‘Find_next’; did you mean ‘_Find_next’?
   54 |             cha = tmp.Find_next(cha);
      |                       ^~~~~~~~~
      |                       _Find_next