Submission #2242270


Source Code Expand

Copy
#include <vector>
#include <iostream>

#pragma GCC optimize ("-O3", "unroll-loops")

using namespace std;

int main()
{
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  size_t n;
  cin >> n;
  vector<unsigned> av(n);
  vector<unsigned> bv(n);
  for ( size_t i = 0; i < n; ++i ) cin >> av[i];
  for ( size_t i = 0; i < n; ++i ) cin >> bv[i];

  const size_t block_size = 8192;

  unsigned ret = 0;
  for ( size_t i = 0; i < n; i += block_size ) {
    size_t i_max = min(n, i + block_size);
    size_t j = 0;
    for ( ; j + 3 < n; j += 4 ) {
      for ( size_t ii = i; ii < i_max; ++ii ) {
        ret ^= av[j] + bv[ii];
        ret ^= av[j + 1] + bv[ii];
        ret ^= av[j + 2] + bv[ii];
        ret ^= av[j + 3] + bv[ii];
      }
    }
    for ( ; j < n; ++j ) {
      for ( size_t ii = i; ii < i_max; ++ii ) {
        ret ^= av[j] + bv[ii];
      }
    }
  }
  cout << ret << endl;

  return 0;
}

Submission Info

Submission Time
Task D - Two Sequences
User AC_Japan
Language C++14 (GCC 5.4.1)
Score 500
Code Size 949 Byte
Status
Exec Time 2967 ms
Memory 1792 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 example_0, example_1, example_2, example_3
All 500 / 500 N100000_0, N100000_1, N150000_0, N150000_1, N200000_0, N200000_1, N200000_ex_0, N200000_ex_1, example_0, example_1, example_2, example_3, rand_0, rand_1, smallrand_0, smallrand_1
Case Name Status Exec Time Memory
N100000_0 742 ms 1024 KB
N100000_1 746 ms 1024 KB
N150000_0 1657 ms 1408 KB
N150000_1 1663 ms 1408 KB
N200000_0 2967 ms 1792 KB
N200000_1 2934 ms 1792 KB
N200000_ex_0 2936 ms 1792 KB
N200000_ex_1 2933 ms 1792 KB
example_0 1 ms 256 KB
example_1 1 ms 256 KB
example_2 1 ms 256 KB
example_3 1 ms 256 KB
rand_0 5 ms 256 KB
rand_1 17 ms 384 KB
smallrand_0 1 ms 256 KB
smallrand_1 1 ms 256 KB