Submission #41803317


Source Code Expand

// With a smile in your heart, that's how I like you again

#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        ll ans = -1;
        for (ll i = (1ll << 60); i > 0; i >>= 1ll) if (i + 2 + 1 <= n && ans == -1)
        {
            for (ll j = (i >> 1ll); j > 0; j >>= 1ll) if (i + j + 1 <= n && ans == -1)
            {
                for (ll k = (j >> 1ll); k > 0; k >>= 1ll) if (i + j + k <= n && ans == -1)
                {
                    ans = i + j + k;
                    break;
                }
            }
        }
        cout << ans << "\n";
    }
    return 0;
}

Submission Info

Submission Time
Task B - Exactly Three Bits
User prvocislo
Language C++ (GCC 9.2.1)
Score 400
Code Size 1045 Byte
Status AC
Exec Time 46 ms
Memory 3548 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 1
AC × 13
Set Name Test Cases
Sample 00-sample-001.txt
All 00-sample-001.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt
Case Name Status Exec Time Memory
00-sample-001.txt AC 14 ms 3480 KiB
01-001.txt AC 45 ms 3484 KiB
01-002.txt AC 44 ms 3448 KiB
01-003.txt AC 44 ms 3444 KiB
01-004.txt AC 32 ms 3492 KiB
01-005.txt AC 38 ms 3516 KiB
01-006.txt AC 46 ms 3496 KiB
01-007.txt AC 42 ms 3488 KiB
01-008.txt AC 43 ms 3484 KiB
01-009.txt AC 44 ms 3548 KiB
01-010.txt AC 43 ms 3496 KiB
01-011.txt AC 44 ms 3488 KiB
01-012.txt AC 45 ms 3488 KiB