Submission #832122

# Submission time Handle Problem Language Result Execution time Memory
832122 2023-08-21T01:57:04 Z KaleemRazaSyed XORanges (eJOI19_xoranges) C++17
0 / 100
613 ms 7900 KB
#include<iostream>

using namespace std;

const int MAXN = 2e5+5, MAXQ = 1e3;

struct chunk
{
  int a[MAXN], ch[MAXQ];
  void add(int x, int i)
  {
    ch[i/MAXQ]^=a[i]^x;
    a[i] = x;
  }
  int Xor(int i, int j)
  {
    int ans = 0;
    while(i <= j)
      {
	if(i%MAXQ==0 and MAXQ <= j-i+1)
	  {
	    ans ^= ch[i/MAXQ];
	    i += MAXQ;
	  }
	else
	  ans ^= a[i++];
      }
    return ans;
  }
};

chunk chunks[2];

int main()
{
  int n, q;
  cin >> n >> q;
  for(int i=0;i<n;i++)
    {
      int x;
      cin >> x;
      chunks[i%2].add(x, i/2);
    }
  
  while(q--)
    {
      int t, i, j;
      cin >> t >> i >> j;
      i--;
      if(t==1)
	chunks[i%2].add(j, i/2);
      else
	cout << chunks[i%2].Xor(i/2, (j-1)/2) << endl;
    }
  
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 613 ms 7900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -