Submission #1311505

#TimeUsernameProblemLanguageResultExecution timeMemory
1311505jahirsha101Pyramids (IOI24_pyramids)C++20
100 / 100
79 ms5400 KiB
#include <bits/stdc++.h>
using namespace std;

int N, Q;
vector<int> A, B;
vector<long long> prefA, prefB;

void init(std::vector<int> a, std::vector<int> b) {
    N = (int)a.size();
    A = std::move(a);
    B = std::move(b);
    prefA.assign(N+1,0);
    prefB.assign(N+1,0);
    for (int i=0; i<N;i++) {prefA[i+1] = prefA[i] + A[i]; prefB[i+1] = prefB[i] + B[i]; }
}

bool can_transform(int L, int R, int X, int Y) {
    long long sA = prefA[R+1] - prefA[L];
    long long sB = prefB[Y+1] - prefB[X];
    return sA == sB;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...