QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#425100#7522. Sequence ShiftpandapythonerWA 23ms10204kbC++171.9kb2024-05-29 22:11:592024-05-29 22:12:01

Judging History

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

  • [2024-05-29 22:12:01]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:10204kb
  • [2024-05-29 22:11:59]
  • 提交

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 = 2e8 / (n + q);
    int b_border = max(0.0, 1e9 - (1e9 / (n + q) * b_can_do));
    auto update = [&](int j) {
        int l = max(0, j - q);
        int r = min(j, n - 1);
        if (b[j] > b_border) {
            for (int k = l; k <= r; k += 1) {
                rs[j - k] = max(rs[j - k], a[k] + b[j]);
            }
        } else {
            for (int x = 0; x < 100; 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

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 7676kb

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: 7700kb

input:

1 0
103509429
823330096

output:

926839525

result:

ok single line: '926839525'

Test #3:

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

input:

1 1
576560149
691846236
1156187222

output:

1268406385
835582012

result:

ok 2 lines

Test #4:

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

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: 23ms
memory: 10204kb

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 66490th lines differ - expected: '1874702083', found: '1869380955'