Submission #457707

# Submission time Handle Problem Language Result Execution time Memory
457707 2021-08-07T10:03:09 Z mansur XORanges (eJOI19_xoranges) C++14
18 / 100
1000 ms 29016 KB
#include<bits/stdc++.h>

#pragma optimize ("g",on)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("03")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native")
             		
using namespace std;

#define all(a) a.begin(), a.end()
#define ll long long
#define pb push_back
#define nl '\n'
#define popb pop_back()
#define sz size()
#define ld long double
#define ull unsigned long long
#define F first
#define S second
#define fix fixed << setprecision
#define pii pair<int, int>
#define E exit (0)
#define int long long

const int inf = (1ll << 62ll), N = 1e5 + 1, mod = 998244353;                    

vector<pii> dd = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

signed main() {
	//freopen("invtrans.in", "r", stdin);
	//freopen("invtrans.out", "w", stdout);
	ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	int n, q;
	cin >> n >> q;
	int a[n + 1];
	for (int i = 1; i <= n; i++) cin >> a[i];
	int num = 1;
	vector<pair<int, pii>> add[n + 2], del[n + 2];
	vector<int> ans(q + 1);
	while (q--) {
		int tp;
		cin >> tp;
		int l, r;
		cin >> l >> r;
		add[l].pb({num, {l, r}});
		del[r + 1].pb({num++, {l, r}});
	}
	set<pair<int, pii>> cur;
	for (int i = 1; i <= n; i++) {
		for (auto e: add[i]) cur.insert(e);
		for (auto e: del[i]) cur.erase(e);
		for (auto e: cur) {
			if (((i - e.S.F + 1) * (e.S.S - i + 1)) & 1) ans[e.F] ^= a[i];	
		}
	}
	for (int i = 1; i < ans.sz; i++) cout << ans[i] << nl;
}      

Compilation message

xoranges.cpp:3: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    3 | #pragma optimize ("g",on)
      | 
xoranges.cpp: In function 'int main()':
xoranges.cpp:58:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |  for (int i = 1; i < ans.sz; i++) cout << ans[i] << nl;
      |                    ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 29016 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -