답안 #683802

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
683802 2023-01-19T11:29:47 Z gagik_2007 Intergalactic ship (IZhO19_xorsum) C++17
17 / 100
2000 ms 1940 KB
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <chrono>
#include <ctime>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <limits>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <functional>
#include <random>
#include <cassert>
using namespace std;

typedef long long ll;
typedef long double ld;

#define ff first
#define ss second

ll ttt;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll N = 1000007;
ll n, m, k;
int a[N];
vector<pair<pair<int, int>, int>>q;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		int l, r, x;
		cin >> l >> r >> x;
		l--, r--;
		q.push_back({ {l,r},x });
	}
	ll ans = 0;
	for (int msk = 0; msk < (1 << m); msk++) {
		for (int i = 0; i < m; i++) {
			if (msk & (1 << i)) {
				for (int j = q[i].ff.ff; j <= q[i].ff.ss; j++) {
					a[j] = a[j] ^ q[i].ss;
				}
			}
		}
		for (int i = 0; i < n; i++) {
			int cur = 0;
			for (int j = i; j < n; j++) {
				cur += a[j];
				ans += ll(cur) * cur;
			}
		}
		ans %= MOD;
		for (int i = 0; i < m; i++) {
			if (msk & (1 << i)) {
				for (int j = q[i].ff.ff; j <= q[i].ff.ss; j++) {
					a[j] = a[j] ^ q[i].ss;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

/// ---- - --------  ------ -------- -- - - -
/// Just a reminder. Ubuntu password is I O I
/// ---- - --------  ------ -------- -- - - -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 6 ms 212 KB Output is correct
7 Correct 6 ms 332 KB Output is correct
8 Correct 8 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 1940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2075 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 892 ms 304 KB Output is correct
2 Correct 892 ms 308 KB Output is correct
3 Correct 893 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 892 ms 304 KB Output is correct
2 Correct 892 ms 308 KB Output is correct
3 Correct 893 ms 316 KB Output is correct
4 Incorrect 10 ms 532 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 6 ms 212 KB Output is correct
7 Correct 6 ms 332 KB Output is correct
8 Correct 8 ms 328 KB Output is correct
9 Correct 892 ms 304 KB Output is correct
10 Correct 892 ms 308 KB Output is correct
11 Correct 893 ms 316 KB Output is correct
12 Incorrect 43 ms 328 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 6 ms 212 KB Output is correct
7 Correct 6 ms 332 KB Output is correct
8 Correct 8 ms 328 KB Output is correct
9 Correct 892 ms 304 KB Output is correct
10 Correct 892 ms 308 KB Output is correct
11 Correct 893 ms 316 KB Output is correct
12 Incorrect 10 ms 532 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 6 ms 212 KB Output is correct
7 Correct 6 ms 332 KB Output is correct
8 Correct 8 ms 328 KB Output is correct
9 Incorrect 16 ms 1940 KB Output isn't correct
10 Halted 0 ms 0 KB -