Submission #161843

# Submission time Handle Problem Language Result Execution time Memory
161843 2019-11-04T16:45:46 Z MvC Intergalactic ship (IZhO19_xorsum) C++11
17 / 100
1137 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;
ll n,q,l[nmax],r[nmax],i,j,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;
	for(i=1;i<=n;i++)cin>>a[i];
	cin>>q;
	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=j*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")
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 206 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1048 ms 380 KB Output is correct
2 Correct 1067 ms 380 KB Output is correct
3 Correct 1137 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1048 ms 380 KB Output is correct
2 Correct 1067 ms 380 KB Output is correct
3 Correct 1137 ms 384 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Correct 1048 ms 380 KB Output is correct
10 Correct 1067 ms 380 KB Output is correct
11 Correct 1137 ms 384 KB Output is correct
12 Incorrect 3 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Correct 1048 ms 380 KB Output is correct
10 Correct 1067 ms 380 KB Output is correct
11 Correct 1137 ms 384 KB Output is correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Incorrect 206 ms 376 KB Output isn't correct
10 Halted 0 ms 0 KB -