답안 #498218

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
498218 2021-12-24T15:50:05 Z sireanu_vlad Intergalactic ship (IZhO19_xorsum) C++14
9 / 100
2000 ms 6876 KB
#include <iostream>
using namespace std;

int mod = 1e9 + 7;
int n, a[1001], q, res, s[100001][3];

void read()
{
	cin >> n;
	for(int i = 1; i <= n; ++i)
		cin >> a[i];
	cin >> q;
	for(int i = 1; i <= q; ++i)
		cin >> s[i][1] >> s[i][2] >> s[i][3];
}

void sum()
{
	for(int i = 1; i <= n; ++i)
		for(int j = i, p; j <= n; ++j)
		{
			p = 0;
			for(int k = i; k <= j; ++k)
				p = (p + a[k]) % mod;
			res = (res + (p*p%mod)) % mod;
		}
}

void up(int l, int r, int x)
{
	for(int i = l; i <= r; ++i)
		a[i] ^= x;
}

void back(int k)
{
	if(k == 0)
		sum();
	if(k > 0)
	{
		up(s[k][1], s[k][2], s[k][3]);
		back(k - 1);
		up(s[k][1], s[k][2], s[k][3]);
		back(k - 1);
	}
}

int main()
{
	read();
	back(q);
	cout << res;
	return 0;
}

Compilation message

xorsum.cpp: In function 'void back(int)':
xorsum.cpp:41:5: warning: array subscript 3 is above array bounds of 'int [3]' [-Warray-bounds]
   41 |   up(s[k][1], s[k][2], s[k][3]);
      |   ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
xorsum.cpp:43:5: warning: array subscript 3 is above array bounds of 'int [3]' [-Warray-bounds]
   43 |   up(s[k][1], s[k][2], s[k][3]);
      |   ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
6 Correct 861 ms 304 KB Output is correct
7 Correct 868 ms 288 KB Output is correct
8 Correct 856 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2069 ms 6876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2078 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2071 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2071 ms 208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
6 Correct 861 ms 304 KB Output is correct
7 Correct 868 ms 288 KB Output is correct
8 Correct 856 ms 300 KB Output is correct
9 Execution timed out 2071 ms 208 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
6 Correct 861 ms 304 KB Output is correct
7 Correct 868 ms 288 KB Output is correct
8 Correct 856 ms 300 KB Output is correct
9 Execution timed out 2071 ms 208 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 2 ms 304 KB Output is correct
6 Correct 861 ms 304 KB Output is correct
7 Correct 868 ms 288 KB Output is correct
8 Correct 856 ms 300 KB Output is correct
9 Execution timed out 2069 ms 6876 KB Time limit exceeded
10 Halted 0 ms 0 KB -