Submission #503734

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5037342022-01-08 18:50:01cig32Snowball (JOI21_ho_t2)C++17
100 / 100
101 ms18408 KiB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = 3e5 + 10;
const int MOD = 1e9 + 7;
#define int long long
int rnd(int x, int y) { // random number generator
int u= uniform_int_distribution<int>(x, y)(rng); return u;
}
void solve(int tc) {
int N, Q;
cin >> N >> Q;
int X[N+1], L[N+1], R[N+1];
for(int i=1; i<=N; i++) cin >> X[i];
int W[Q+1], ps[Q+1], maxp[Q+1], minp[Q+1];
minp[0] = 0;
maxp[0] = 0;
ps[0] = 0;
for(int i=1; i<=Q; i++) {
cin >> W[i];
ps[i] = ps[i-1] + W[i];
maxp[i] = max(maxp[i-1], ps[i]);
minp[i] = min(minp[i-1], ps[i]);
}
L[1] = X[1] + minp[Q];
R[N] = X[N] + maxp[Q];
for(int i=1; i<N; i++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...