/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 500.0 KiB
#2 Accepted 3ms 540.0 KiB
#3 Accepted 3ms 392.0 KiB
#4 Accepted 3ms 588.0 KiB
#5 Accepted 13ms 872.0 KiB
#6 Accepted 5ms 628.0 KiB
#7 Accepted 20ms 1.082 MiB
#8 Accepted 20ms 1.371 MiB

Code

#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define endl '\n'
#define Endl '\n'

using namespace std;

const int N = 2e5 + 5;
int tc, n, m, a[N];

random_device rd;
mt19937 eng(rd());

ll computeXOR(ll n) {
    if (n % 4 == 0)
        return n;
    if (n % 4 == 1)
        return 1;
    if (n % 4 == 2)
        return n + 1;
    return 0;
}

int getRandomNumberInRange(int min, int max) {

    uniform_int_distribution<> distribution(min, max);

    return distribution(eng);
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); // cout.tie(0);
    cin >> tc;
    while (tc--) {
        cin >> n;
        cout << computeXOR(n) << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1009 XOR Love
Language
C++17 (G++ 13.2.0)
Submit At
2023-12-04 16:36:09
Judged At
2023-12-26 21:06:03
Judged By
Score
100
Total Time
20ms
Peak Memory
1.371 MiB