답안 #161842

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
161842 2019-11-04T16:37:35 Z MvC Intergalactic ship (IZhO19_xorsum) C++11
0 / 100
18 ms 504 KB
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e2+50;
const ll mod=1e9+7;
int n,q,l[nmax],r[nmax],i,j;
ll xr[nmax],b[nmax],a[nmax],rs,cur,prsm,sm,sqprsm,f[nmax];
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>q;
	for(i=1;i<=n;i++)cin>>a[i];
	for(i=0;i<q;i++)cin>>l[i]>>r[i]>>xr[i];
	for(i=0;i<(1<<q);i++)
	{
		for(j=1;j<=n;j++)f[j]=0,b[j]=a[j];
		for(j=0;j<q;j++)if(i&(1<<j))f[l[j]]^=xr[j],f[r[j]+1]^=xr[j];
		for(j=1;j<=n;j++)
		{
			f[j]^=f[j-1];
			b[j]^=f[j];
		}
		sm=prsm=sqprsm=0;
		for(j=1;j<=n;j++)
		{
			sm=(sm+b[j])%mod;
			cur=i*sm%mod*sm%mod;
			cur=(cur-sqprsm+mod)%mod;
			cur=(cur-sm*prsm%mod*2LL%mod+mod)%mod;
			rs=(rs+cur)%mod;
			prsm=(prsm+sm)%mod;
			sqprsm=(sqprsm+sm*sm%mod)%mod;
		}
	}
	cout<<rs<<endl;
	return 0;
}

Compilation message

xorsum.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
xorsum.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -