Submission #1127775
Source Code Expand
#include <cstdio> #include <cstdint> #include <cstdlib> #include <algorithm> #define repeat(i,n) for (int i = 0; (i) < int(n); ++(i)) #define repeat_from(i,m,n) for (int i = (m); (i) < int(n); ++(i)) using namespace std; const int inf = 1e9+7; #define N_MAX 100000 int32_t a[N_MAX]; int32_t xor_acc[N_MAX+1]; int main() { int n, q; scanf("%d%d", &n, &q); repeat (i,n) scanf("%u", &a[i]); xor_acc[0] = 0; repeat (i,n) xor_acc[i+1] = xor_acc[i] ^ a[i]; int m = - inf; while (q --) { int l, r; scanf("%d%d", &l, &r); if (m == - inf) { -- l; } else { l = (l + abs(m)) % n; r = (r + abs(m)) % n + 1; } int32_t x = xor_acc[r] ^ xor_acc[l]; int32_t d = 0x7fffffff; m = - inf; repeat_from (i, l, r-1) { d &= a[i]; x ^= a[i]; m = max(m, d - x); } printf("%d\n", m); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | J - XORAND |
User | kimiyuki |
Language | C++14 (Clang 3.8.0) |
Score | 0 |
Code Size | 955 Byte |
Status | RE |
Exec Time | 4203 ms |
Memory | 2176 KB |
Judge Result
Set Name | Sample | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_sample_01.txt, subtask0_sample_02.txt |
All | subtask0_sample_01.txt, subtask0_sample_02.txt, subtask1_pow2_01_mini.txt, subtask1_pow2_02_mini.txt, subtask1_pow2_03_OnlyOneLargeSeg.txt, subtask1_pow2_04_UniqueLargeSegs_BitChangesEverytime.txt, subtask1_pow2_05_UniqueLargeSegs.txt, subtask1_pow2_06_randomSegs.txt, subtask1_pow2_07_randomSegs.txt, subtask1_pow2_08_randomSegs.txt, subtask1_pow2_09_x_to_N-x_SegsOnly.txt, subtask1_pow2_10_x_to_N_SegsOnly.txt, subtask1_pow2_11_length_1_3_7_15_31_etc_SegsOnly_BitChangesEverytime.txt, subtask1_pow2_12_1_3_7_15_31_etc_lengthSegsPlusAlpha_BitChangesEverytime.txt, subtask1_random_01.txt, subtask1_random_02.txt, subtask1_result_minmax_01.txt, subtask1_result_minmax_02.txt, subtask1_result_minmax_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask0_sample_01.txt | AC | 1 ms | 256 KB |
subtask0_sample_02.txt | AC | 1 ms | 256 KB |
subtask1_pow2_01_mini.txt | AC | 3 ms | 256 KB |
subtask1_pow2_02_mini.txt | AC | 3 ms | 256 KB |
subtask1_pow2_03_OnlyOneLargeSeg.txt | WA | 42 ms | 2176 KB |
subtask1_pow2_04_UniqueLargeSegs_BitChangesEverytime.txt | TLE | 4203 ms | 1408 KB |
subtask1_pow2_05_UniqueLargeSegs.txt | WA | 43 ms | 2176 KB |
subtask1_pow2_06_randomSegs.txt | RE | 111 ms | 1024 KB |
subtask1_pow2_07_randomSegs.txt | RE | 111 ms | 1024 KB |
subtask1_pow2_08_randomSegs.txt | RE | 112 ms | 1024 KB |
subtask1_pow2_09_x_to_N-x_SegsOnly.txt | RE | 119 ms | 1024 KB |
subtask1_pow2_10_x_to_N_SegsOnly.txt | TLE | 4203 ms | 1920 KB |
subtask1_pow2_11_length_1_3_7_15_31_etc_SegsOnly_BitChangesEverytime.txt | TLE | 4203 ms | 1920 KB |
subtask1_pow2_12_1_3_7_15_31_etc_lengthSegsPlusAlpha_BitChangesEverytime.txt | TLE | 4203 ms | 1408 KB |
subtask1_random_01.txt | AC | 3308 ms | 1280 KB |
subtask1_random_02.txt | AC | 3297 ms | 1280 KB |
subtask1_result_minmax_01.txt | WA | 1 ms | 256 KB |
subtask1_result_minmax_02.txt | AC | 1 ms | 256 KB |
subtask1_result_minmax_03.txt | AC | 1 ms | 256 KB |