QOJ.ac
QOJ
ID | 提交记录ID | 题目 | Hacker | Owner | 结果 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|
#1067 | #671832 | #21686. 【NOIP Round #2】恰钱 | max666dong123 | wth2026 | Failed. | 2024-10-24 16:19:30 | 2024-10-24 16:19:34 |
詳細信息
Extra Test:
Accepted
time: 394ms
memory: 8740kb
input:
100000 476289515 610937788 410343539 775185229 353875262 799553910 549025140 811311440 65477595 821985811 171817706 321708889 159161355 703973738 266366662 608320727 504945211 990558239 510778537 719553845 120402685 212719120 95141813 425317196 50101581 90262630 90247185 263988968 353400143 37020123...
output:
476292096 410346496 353875968 549028096 65479680 171820032 159163392 266369024 504947712 510783488 120402944 95142912 50102784 90247296 353400320 450429440 257438720 194792448 390867968 705262080 214237312 309080576 437840896 253239552 693309952 285280128 26599936 289459456 193626368 101908544 70440...
result:
ok Accepted!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#671832 | #21686. 【NOIP Round #2】恰钱 | wth2026 | 100 ✓ | 407ms | 9288kb | C++14 | 1.5kb | 2024-10-24 14:37:34 | 2024-10-24 14:37:34 |
answer
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define inf 0x3f3f3f3f
#define lnf 0x3f3f3f3f3f3f3f3f
const bool Debug = false;
//#define Debug true
using namespace std;
void input (int& x) {
x = 0;
char c = getchar ();
while (! isdigit (c)) {
c = getchar ();
}
while (isdigit (c)) {
x = (x << 3) + (x << 1) + (c ^ 48);
c = getchar ();
}
}
void output (int x) {
register char _Wrt[25], cnt = 0;
do {
_Wrt[++ cnt] = x % 10;
x /= 10;
} while (x);
do {
putchar (_Wrt[cnt] | 48);
-- cnt;
} while (cnt);
}
int lowbit (int x) {
return x & -x;
}
int ppc (int x) {
int _ = 0;
while (x) {
++ _;
x -= lowbit (x);
}
return _;
}
int l, r;
int a[2] = {134217729, 100663297};
vector <int> ok;
signed main () {
// freopen ("qiaqia.in", "r", stdin);
// freopen ("qiaqia.out", "w", stdout);
for (register int i = 1; i <= 1e8; ++ i) {
if ((i & 1) && (i << ppc (i)) <= 1e9) {
ok.push_back (i << ppc (i));
}
}
for (register int i = 0; i < 2; ++ i) {
ok.push_back (a[i] << ppc (a[i]));
}
sort (ok.begin (), ok.end ());
if (Debug) {
cout << ok.size () << endl;
}
int T;
input (T);
while (T --) {
input (l);
input (r);
auto it = lower_bound (ok.begin (), ok.end (), l);
if (it != ok.end () && (* it) <= r) {
output (* it);
putchar ('\n');
} else {
putchar ('-');
putchar ('1');
putchar ('\n');
}
}
return 0;
}