提出 #11263481


ソースコード 拡げる

// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double long double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
#define pr pair<int,int>
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAXN = 2e5 + 10;
int a[MAXN],b[MAXN],c[MAXN];

void solve(){
    int n; cin>>n;
    FOR(i,1,n) cin>>a[i];
    FOR(i,1,n) cin>>b[i];
    
    int ans = 0;  
    FOR(bit,0,28){
        int T = (1LL<<bit);
        FOR(i,1,n) c[i] = b[i]%(2*T);
        sort(c+1,c+n+1);
        int cnt = 0;

        FOR(i,1,n){ 
            int val = a[i]%(2*T);
            int temp1 = lower_bound(c+1,c+n+1,2*T - val) - lower_bound(c+1,c+n+1,T - val);
            int temp2 = lower_bound(c+1,c+n+1,4*T - val) - lower_bound(c+1,c+n+1,3*T - val);
            cnt = cnt + temp1 + temp2;
        }
        ans = (ans + (cnt%2)*T);
    }

    cout<<ans<<endl;
}

signed main(){

   FastRead;    

    int t = 1; 
    // cin>>t; 
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

提出情報

提出日時
問題 D - Two Sequences
ユーザ saikuNoCoda
言語 C++14 (GCC 5.4.1)
得点 500
コード長 2018 Byte
結果 AC
実行時間 2093 ms
メモリ 4992 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 4
AC × 16
セット名 テストケース
Sample example_0, example_1, example_2, example_3
All 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
ケース名 結果 実行時間 メモリ
N100000_0 AC 959 ms 4096 KiB
N100000_1 AC 955 ms 3584 KiB
N150000_0 AC 1530 ms 4224 KiB
N150000_1 AC 1524 ms 4224 KiB
N200000_0 AC 2093 ms 4992 KiB
N200000_1 AC 2087 ms 4992 KiB
N200000_ex_0 AC 1971 ms 4992 KiB
N200000_ex_1 AC 1972 ms 4992 KiB
example_0 AC 2 ms 2304 KiB
example_1 AC 2 ms 2304 KiB
example_2 AC 2 ms 2304 KiB
example_3 AC 2 ms 2304 KiB
rand_0 AC 46 ms 2432 KiB
rand_1 AC 100 ms 2560 KiB
smallrand_0 AC 2 ms 2304 KiB
smallrand_1 AC 2 ms 2304 KiB