/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 580.0 KiB
#2 Accepted 3ms 532.0 KiB
#3 Accepted 3ms 580.0 KiB
#4 Accepted 3ms 580.0 KiB
#5 Accepted 13ms 836.0 KiB
#6 Accepted 4ms 580.0 KiB
#7 Accepted 19ms 1004.0 KiB
#8 Accepted 20ms 1.48 MiB

Code

//....................................<In the name of Allah>...............................//

//.................................<b_bitsmillahir Rahmanir Rahim>...................................//
// Author : Riaj Udd_bitn

#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, nll_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> pii;
typedef pair<double, double> pdd;

typedef double dl;

#define lower(a, b) lower_bound((a).begin(), (a).end(), b) - (a).begin()
#define mem(a, b) memset(a, b, sizeof(a));

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define fraction(a)               \
    cout.unsetf(ios::floatfield); \
    cout.precision(a);            \
    cout.setf(ios::fined, ios::floatfield);
//////////////////////////////////////////

///////////bit-manipulation///////////////
#define Mb(msk) 63 - __builtin_clzll(msk)
#define Lb(msk) __builtin_ctzll(msk)
#define ONE(msk) __builtin_popkll(msk)
#define CHECK(msk, bit) (msk & (1LL << bit))
#define ON(msk, bit) (msk | (1LL << bit))
#define Off(msk, bit) (msk & ~(1LL << bit))
#define CHANGE(msk, bit) (msk ^ (1LL << bit))

//////////////
const ll MOD = 1e9 + 7;
inline void normal(ll &a)
{
    a %= MOD;
    (a < 0) && (a += MOD);
}
inline ll modMul(ll a, ll b)
{
    a %= MOD, b %= MOD;
    normal(a), normal(b);
    return (a * b) % MOD;
}
inline ll modAdd(ll a, ll b)
{
    a %= MOD, b %= MOD;
    normal(a), normal(b);
    return (a + b) % MOD;
}
inline ll modSub(ll a, ll b)
{
    a %= MOD, b %= MOD;
    normal(a), normal(b);
    a -= b;
    normal(a);
    return a;
}
inline ll modPow(ll b, ll p)
{
    ll r = 1;
    while (p)
    {
        if (p & 1)
            r = modMul(r, b);
        b = modMul(b, b);
        p >>= 1;
    }
    return r;
}
inline ll modInverse(ll a) { return modPow(a, MOD - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

// std::ofstream outputFile("C:/Users/Asus/Desktop/New folder/output.txt");
ll computeXOR(ll n)
{
    if (n % 4 == 0)
        return n;
    if (n % 4 == 1)
        return 1;
    if (n % 4 == 2)
        return n + 1;
    else
        return 0;
}
void solve()
{
    ll n;
    cin >> n;
    cout << computeXOR(n);
    cout << "\n";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll t = 1;
    cin >> t;
    for (ll tc = 1; tc <= t; tc++)
        solve();
}

Information

Submit By
Type
Submission
Problem
P1009 XOR Love
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-03 05:20:46
Judged At
2024-11-11 02:34:11
Judged By
Score
100
Total Time
20ms
Peak Memory
1.48 MiB