# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337463 | 2020-12-20T22:16:10 Z | scales | Intergalactic ship (IZhO19_xorsum) | C++17 | 2000 ms | 2668 KB |
#include <bits/stdc++.h> /*#ifndef LOCAL_RUN #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("fast-math") #pragma GCC target("avx2,tune=native") #endif*/ ////////////////////BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB using namespace std; long long M=1000000007; int main() { ios::sync_with_stdio(false); cin.tie(0); //freopen("","r",stdin); //freopen("","w",stdout); long long t,i,j,mini,x,y,z,q,m,k,kol,x1,tip,g,maxi,n,y1,sum; cin>>n; vector<long long> a(n),b(n); for(i=0;i<n;i++) { cin>>a[i]; } cin>>m; vector<long long> l(m),r(m),v(m); for(i=0;i<m;i++) { cin>>l[i]; cin>>r[i]; l[i]--; r[i]--; cin>>v[i]; } vector<long long> pref(n); if(m<=20) { vector<long long> st(21); st[0]=1; for(i=1;i<=20;i++) { st[i]=2*st[i-1]; } //cout<<"aaaaaaa"<<endl; sum=0; for(i=0;i<st[m];i++) { //cout<<"i="<<i<<endl; for(j=0;j<n;j++) { b[j]=a[j]; } for(j=0;j<m;j++) { z=st[j]&i; //cout<<"z="<<z<<endl; if(z!=0) { for(q=l[j];q<=r[j];q++) { b[q]=b[q]^v[j]; //cout<<"a b[q]="<<b[q]<<endl; } } } pref[0]=b[0]; // cout<<"pref[0]="<<pref[0]<<endl; for(j=1;j<n;j++) { pref[j]=pref[j-1]+b[j]; // cout<<"b[j]="<<b[j]<<" pref["<<j<<"]="<<pref[j]<<endl; } //cout<<"sum="<<sum<<endl; for(j=0;j<n;j++) { for(q=j;q<n;q++) { x=pref[q]; if(j!=0) { x=x-pref[j-1]; } x=x*x; //cout<<"x="<<x<<" "; sum=sum+x; sum=sum%M; } } // cout<<"sum="<<sum<<endl; } cout<<sum<<endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 28 ms | 364 KB | Output is correct |
7 | Correct | 28 ms | 364 KB | Output is correct |
8 | Correct | 29 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 2668 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2065 ms | 364 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2065 ms | 364 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 28 ms | 364 KB | Output is correct |
7 | Correct | 28 ms | 364 KB | Output is correct |
8 | Correct | 29 ms | 364 KB | Output is correct |
9 | Execution timed out | 2065 ms | 364 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 28 ms | 364 KB | Output is correct |
7 | Correct | 28 ms | 364 KB | Output is correct |
8 | Correct | 29 ms | 364 KB | Output is correct |
9 | Execution timed out | 2065 ms | 364 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 28 ms | 364 KB | Output is correct |
7 | Correct | 28 ms | 364 KB | Output is correct |
8 | Correct | 29 ms | 364 KB | Output is correct |
9 | Incorrect | 21 ms | 2668 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |