QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#425138#7522. Sequence ShiftpandapythonerWA 21ms8144kbC++201.9kb2024-05-29 22:31:442024-05-29 22:31:45

Judging History

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

  • [2024-05-29 22:31:45]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:8144kb
  • [2024-05-29 22:31:44]
  • 提交

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)(500) * n / (n + q - pos);
        aboba = min(aboba, n);
        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;
}


詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 7680kb

input:

5 3
1 4 3 2 5
7 5 8 3 2
3
6
4

output:

11
13
16
25

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 7908kb

input:

1 0
103509429
823330096

output:

926839525

result:

ok single line: '926839525'

Test #3:

score: 0
Accepted
time: 0ms
memory: 7752kb

input:

1 1
576560149
691846236
1156187222

output:

1268406385
835582012

result:

ok 2 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 7688kb

input:

1 10
700282491
332230980
90825676
1630266999
644973380
262379760
2122877054
1851957134
1370195232
110993724
1319359505
1883523208

output:

1032513471
1654684398
759763732
888538827
1695749302
1163465539
1425605448
789576931
1397740634
1202288326
1638577353

result:

ok 11 lines

Test #5:

score: -100
Wrong Answer
time: 21ms
memory: 8144kb

input:

1000 100000
438001359 929744877 710148392 323984311 727016267 323629255 495752276 309120511 312675195 717795522 937464489 624952229 444774478 829169766 707441777 609125148 25459976 849166512 716162953 882416779 189669312 135698832 632796131 592794700 569746403 231058028 389412868 824283503 801480367...

output:

1962871590
1986083253
1967509108
1973351244
1974354421
1956371849
1976394149
1995721753
1946870160
1984280254
1961237540
1955903880
1944520591
1937726835
1993563403
1927000559
1951483558
1979133252
1979156812
1941301401
1922284543
1980597785
1963663583
1946961524
1933606347
1953947075
1953071855
194...

result:

wrong answer 11896th lines differ - expected: '1844919952', found: '1826712270'