Submission #961395

# Submission time Handle Problem Language Result Execution time Memory
961395 2024-04-12T03:35:35 Z pcc Intergalactic ship (IZhO19_xorsum) C++17
17 / 100
272 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>

const ll mod = 1e9+7;
const int mxn = 1010;
const int B = 7;
vector<int> ori;
array<int,3> req[mxn*100];
int N,Q;
ll ans = 0;

ll mad(ll a,ll b){
	a += b;
	return a>=mod?a-mod:a;
}
ll mub(ll a,ll b){
	return mad(a,mod-b);
}

ll calc(vector<int> v){
	ll sq = 0,sum = 0,sum2 = 0;
	for(auto &i:v){
		sum = mad(sum,i);
		sum2 += sum;
		sq = mad(sq,sum*sum%mod);
	}
	return mub(sq*(N+1)%mod,sum2*sum2%mod);
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N;
	ori.resize(N);
	for(int i = 0;i<N;i++)cin>>ori[i];
	cin>>Q;
	if(Q>20)return 0;
	for(int i = 0;i<Q;i++)cin>>req[i][0]>>req[i][1]>>req[i][2],req[i][0]--,req[i][1]--;
	for(int i = 0;i<(1<<Q);i++){
		auto tmp = ori;
		for(int j = 0;j<Q;j++){
			if(i&(1<<j)){
				for(int k = req[j][0];k<=req[j][1];k++)tmp[k]^=req[j][2];
			}
		}
		ans = mad(ans,calc(tmp));
	}
	cout<<ans<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 255 ms 600 KB Output is correct
2 Correct 272 ms 348 KB Output is correct
3 Correct 252 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 255 ms 600 KB Output is correct
2 Correct 272 ms 348 KB Output is correct
3 Correct 252 ms 440 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 255 ms 600 KB Output is correct
10 Correct 272 ms 348 KB Output is correct
11 Correct 252 ms 440 KB Output is correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 255 ms 600 KB Output is correct
10 Correct 272 ms 348 KB Output is correct
11 Correct 252 ms 440 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -