Submission #41996953
Source Code Expand
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <algorithm> #include <cmath> using namespace std; #define mp make_pair #define pb push_back #define ll long long int t; ll n; ll bump(ll x, ll n, ll pos) { while (true) { if (x & (1LL << (pos + 1))) return x; ll next = x - (1LL << pos) + (1LL << pos) * 2; if (next > n) return x; pos++; x = next; } } ll solve(ll n) { if (n < 7) return -1; ll x = 7; x = bump(x, n, 2); x = bump(x, n, 1); x = bump(x, n, 0); return x; } int main() { cin >> t; for (int ti = 0; ti < t; ti++) { cin >> n; cout << solve(n) << '\n'; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Exactly Three Bits |
User | atatomir |
Language | C++ (GCC 9.2.1) |
Score | 400 |
Code Size | 761 Byte |
Status | AC |
Exec Time | 232 ms |
Memory | 3564 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
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 | 10 ms | 3492 KiB |
01-001.txt | AC | 229 ms | 3564 KiB |
01-002.txt | AC | 228 ms | 3328 KiB |
01-003.txt | AC | 227 ms | 3376 KiB |
01-004.txt | AC | 180 ms | 3376 KiB |
01-005.txt | AC | 204 ms | 3512 KiB |
01-006.txt | AC | 232 ms | 3564 KiB |
01-007.txt | AC | 226 ms | 3512 KiB |
01-008.txt | AC | 204 ms | 3508 KiB |
01-009.txt | AC | 209 ms | 3500 KiB |
01-010.txt | AC | 213 ms | 3492 KiB |
01-011.txt | AC | 225 ms | 3476 KiB |
01-012.txt | AC | 227 ms | 3376 KiB |