답안 #1067640

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1067640 2024-08-20T22:18:51 Z raduv XORanges (eJOI19_xoranges) C++14
100 / 100
33 ms 3932 KB
#include <stdio.h>
#include <ctype.h>
#pragma GCC optimize("Ofast,unroll-loops,inline-functions")
#pragma GCC target("avx2")
#pragma unroll
#pragma loop(ivdep)
#pragma ivdep
#pragma omp parallel for
#pragma HLS pipeline
#pragma clang loop unroll(full)
#pragma inline
#pragma vector always
#pragma STDC FP_CONTRACT ON
#pragma acc kernels
#pragma auto_inline(on)
#pragma prefetch

const int MAXN = 2e5;
using namespace std;
int aib[2][MAXN + 1];
int v[MAXN + 1];
void update(int poz, int x, int n){
  int i;
  for( i = poz; i <= n; i += i & -i){
    aib[poz & 1][i] ^= x;
  }
}
int query(int poz, int par){
  int rez = 0, i;
  for( i = poz; i > 0; i = (i & (i - 1))){
    rez ^= aib[par][i];
  }
  return rez;
}
static inline int getInt(){
  int n = 0, ch;
  while(!isdigit(ch = getc(stdin)));
  do
    n = n * 10 + ch - '0';
  while (isdigit(ch = getc(stdin)));
  return n;
}
int main(){
  int n, q, i, op, l, r;
  n = getInt();
  q = getInt();
  for( i = 1; i <= n; i++ ){
    v[i] = getInt();
    update(i, v[i], n);
  }
  for( i = 0; i < q; i++ ){
    op = getInt();
    l = getInt();
    r = getInt();
    if(op == 1){
      update(l, v[l] ^ r, n);
      v[l] = r;
    }
    else{
      if( (r - l) & 1 ){
        printf("0\n");
      }
      else{
        printf("%d\n", query(r, r & 1) ^ query(l - 1, l & 1));
      }
    }
  }
  return 0;
}

Compilation message

xoranges.cpp:5: warning: ignoring '#pragma unroll ' [-Wunknown-pragmas]
    5 | #pragma unroll
      | 
xoranges.cpp:6: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
    6 | #pragma loop(ivdep)
      | 
xoranges.cpp:7: warning: ignoring '#pragma ivdep ' [-Wunknown-pragmas]
    7 | #pragma ivdep
      | 
xoranges.cpp:8: warning: ignoring '#pragma omp parallel' [-Wunknown-pragmas]
    8 | #pragma omp parallel for
      | 
xoranges.cpp:9: warning: ignoring '#pragma HLS pipeline' [-Wunknown-pragmas]
    9 | #pragma HLS pipeline
      | 
xoranges.cpp:10: warning: ignoring '#pragma clang loop' [-Wunknown-pragmas]
   10 | #pragma clang loop unroll(full)
      | 
xoranges.cpp:11: warning: ignoring '#pragma inline ' [-Wunknown-pragmas]
   11 | #pragma inline
      | 
xoranges.cpp:12: warning: ignoring '#pragma vector always' [-Wunknown-pragmas]
   12 | #pragma vector always
      | 
xoranges.cpp:13: warning: ignoring '#pragma STDC FP_CONTRACT' [-Wunknown-pragmas]
   13 | #pragma STDC FP_CONTRACT ON
      | 
xoranges.cpp:14: warning: ignoring '#pragma acc kernels' [-Wunknown-pragmas]
   14 | #pragma acc kernels
      | 
xoranges.cpp:15: warning: ignoring '#pragma auto_inline ' [-Wunknown-pragmas]
   15 | #pragma auto_inline(on)
      | 
xoranges.cpp:16: warning: ignoring '#pragma prefetch ' [-Wunknown-pragmas]
   16 | #pragma prefetch
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 3924 KB Output is correct
2 Correct 29 ms 3932 KB Output is correct
3 Correct 29 ms 3776 KB Output is correct
4 Correct 27 ms 3920 KB Output is correct
5 Correct 26 ms 3928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 33 ms 3924 KB Output is correct
16 Correct 29 ms 3932 KB Output is correct
17 Correct 29 ms 3776 KB Output is correct
18 Correct 27 ms 3920 KB Output is correct
19 Correct 26 ms 3928 KB Output is correct
20 Correct 26 ms 3244 KB Output is correct
21 Correct 29 ms 3164 KB Output is correct
22 Correct 29 ms 3308 KB Output is correct
23 Correct 28 ms 3664 KB Output is correct
24 Correct 26 ms 3668 KB Output is correct