Submission #495489

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4954892021-12-19 01:47:19couplefireSum Zero (RMI20_sumzero)C++17
0 / 100
4 ms1100 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 400005;
int n, q; bitset<19> to[N][5];
map<ll, int> mp; ll sum;
int main(){
// freopen("a.in", "r", stdin);
cin.tie(0)->sync_with_stdio(0);
cin >> n; mp[0] = 0;
for(int i = 1; i<=n; ++i){
int a; cin >> a;
sum += a; to[i][0] = to[i-1][0];
if(mp.count(sum))
to[i][0] = max((int)to[i][0].to_ulong(), mp[sum]+1);
mp[sum] = i;
} mp.clear();
for(int j = 1; j<5; ++j)
for(int i = 1; i<=n; ++i){
int bruh = i+1;
for(int k = 0; k<16; ++k)
bruh = to[bruh-1][j-1].to_ulong();
to[i][j] = bruh;
}
cin >> q;
while(q--){
int l, r; cin >> l >> r;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...