Submission #1127794


Source Code Expand

#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <algorithm>
// #include <vector>
#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))
typedef long long ll;
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);
// vector<int> a(n);
    repeat (i,n) scanf("%u", &a[i]);
// vector<int> xor_acc(n+1);
    xor_acc[0] = 0;
    repeat (i,n) xor_acc[i+1] = xor_acc[i] ^ a[i];
    ll 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;
// if (r < l) swap(l, r);
// if (l == r) l = 0;
// if (l == r) r = n;
        }
        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 -(ll) 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 1121 Byte
Status WA
Exec Time 4203 ms
Memory 2048 KB

Compile Error

./Main.cpp:41:24: warning: format specifies type 'int' but the argument has type 'll' (aka 'long long') [-Wformat]
        printf("%d\n", m);
                ~~     ^
                %lld
1 warning generated.

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
AC × 2
AC × 11
WA × 1
TLE × 7
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 TLE 4203 ms 1408 KB
subtask1_pow2_04_UniqueLargeSegs_BitChangesEverytime.txt TLE 4203 ms 1408 KB
subtask1_pow2_05_UniqueLargeSegs.txt TLE 4203 ms 1408 KB
subtask1_pow2_06_randomSegs.txt AC 3998 ms 2048 KB
subtask1_pow2_07_randomSegs.txt AC 3991 ms 2048 KB
subtask1_pow2_08_randomSegs.txt AC 3990 ms 2048 KB
subtask1_pow2_09_x_to_N-x_SegsOnly.txt TLE 4203 ms 1792 KB
subtask1_pow2_10_x_to_N_SegsOnly.txt TLE 4203 ms 1792 KB
subtask1_pow2_11_length_1_3_7_15_31_etc_SegsOnly_BitChangesEverytime.txt TLE 4203 ms 1792 KB
subtask1_pow2_12_1_3_7_15_31_etc_lengthSegsPlusAlpha_BitChangesEverytime.txt TLE 4203 ms 1280 KB
subtask1_random_01.txt AC 3988 ms 1280 KB
subtask1_random_02.txt AC 3963 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