QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#425140#7522. Sequence ShiftpandapythonerCompile Error//C++202.0kb2024-05-29 22:34:272024-05-29 22:34:29

Judging History

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

  • [2024-05-29 22:34:29]
  • 评测
  • [2024-05-29 22:34:27]
  • 提交

answer

#pragma GCC optimize("Ofast,unroll-loops,fast-math")
#pragma GCC target("avx,avx2")


#include <bits/stdc++.h>


using namespace std;


#define ll long long
#define flt double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()


const ll inf = 1e18;
mt19937 rnd(234);
const ll mod = 1e9 + 7;
typedef complex<flt> base;
const flt pi = atan2(1, 0) * 2;

const int maxn = 1e6;
int n, q;
int a[maxn];
int b[maxn * 2];
int rs[maxn + 10];


int32_t main() {
    if (1) {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }
    cin >> n >> q;
    for (int i = 0; i < n; i += 1) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i += 1) {
        cin >> b[i];
    }
    for (int i = 0; i <= q; i += 1) {
        rs[i] = 0;
    }
    vector<int> sa(n);
    for (int i = 0; i < n; i += 1) {
        sa[i] = i;
    }
    sort(all(sa), [&](int i, int j) {return a[i] > a[j];});
    int last = 0;
    int b_can_do = 4e8 / n;
    int b_border = max(0.0, 1e9 - (1e9 / (n + q) * b_can_do));

    int super_can_do = 4e8 / 1e4;
    int super_border = max(0.0, 1e9 - (1e9 / (n + q) * super_can_do));
    auto update = [&](int j) {
        int l = max(0, j - q);
        int r = min(j, n - 1);
        int pos = b[j] / (1e9 / (n + q));
        assert(0 <= pos and pos < n + q);
        int aboba = (flt)(200) * (n + q) / (n + q - pos);
        aboba = max(aboba, 200);
        aboba = min(aboba, n - 1);
        for (int x = 0; x <= aboba; x += 1) {
            int k = sa[x];
            if (l <= k and k <= r) {
                rs[j - k] = max(rs[j - k], a[k] + b[j]);
            }
        }
        };
    for (int j = 0; j < n; j += 1) {
        update(j);
    }
    for (int i = 0; i <= q; i += 1) {
        last = rs[i];
        cout << last << "\n";
        if (i < q) {
            int j = n + i;
            cin >> b[j];
            b[j] ^= last;
            update(j);
        }
    }
    return 0;
}


Details

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from answer.code:5:
/usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~