# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
337464 | 2020-12-20T22:18:54 Z | scales | Intergalactic ship (IZhO19_xorsum) | C++17 | 881 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; } } // cout<<"sum="<<sum<<endl; } sum=sum%M; cout<<sum<<endl; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 8 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |
8 | Correct | 6 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 2668 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 861 ms | 388 KB | Output is correct |
2 | Correct | 881 ms | 492 KB | Output is correct |
3 | Correct | 834 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 861 ms | 388 KB | Output is correct |
2 | Correct | 881 ms | 492 KB | Output is correct |
3 | Correct | 834 ms | 364 KB | Output is correct |
4 | Incorrect | 2 ms | 492 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 8 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |
8 | Correct | 6 ms | 364 KB | Output is correct |
9 | Correct | 861 ms | 388 KB | Output is correct |
10 | Correct | 881 ms | 492 KB | Output is correct |
11 | Correct | 834 ms | 364 KB | Output is correct |
12 | Incorrect | 1 ms | 364 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 8 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |
8 | Correct | 6 ms | 364 KB | Output is correct |
9 | Correct | 861 ms | 388 KB | Output is correct |
10 | Correct | 881 ms | 492 KB | Output is correct |
11 | Correct | 834 ms | 364 KB | Output is correct |
12 | Incorrect | 2 ms | 492 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 8 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |
8 | Correct | 6 ms | 364 KB | Output is correct |
9 | Incorrect | 21 ms | 2668 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |