QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#282959 | #6563. Four Square | warner1129# | WA | 1ms | 3396kb | C++20 | 1.7kb | 2023-12-13 15:45:34 | 2023-12-13 15:45:34 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
template <class... T> void dbg(T... x) { char e{}; ((cerr << e << x, e = ' '), ...); }
template <class T> void org(T l, T r) { while (l != r) cerr << ' ' << *l++; cerr << '\n'; }
#define debug(x...) dbg(#x, '=', x, '\n')
#define olist(x...) dbg(#x, '='), org(x)
#else
#define debug(...) ((void)0)
#define olist(...) ((void)0)
#endif
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define ff first
#define ss second
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
using Pt = pair<int, int>;
template <class T> inline constexpr T inf = numeric_limits<T>::max() / 2;
constexpr int mod = 998244353;
template<class T> bool chmin(T &a, T b) { return (b < a and (a = b, true)); }
template<class T> bool chmax(T &a, T b) { return (a < b and (a = b, true)); }
template<class... T> int add(T... x) { int t{}; return (((t += x) %= mod), ...), t; }
template<class... T> int mul(T... x) { i64 t{1}; return (((t *= x) %= mod), ...), t; }
void solve() {
i64 n, d;
cin >> n >> d;
auto cal = [&](i64 t) -> i64 {
i64 cnt = 0;
i64 x = n;
i64 r = (1ll << t);
while (x > 1) {
x = (x + r - 1) / r;
cnt++;
}
debug(cnt);
return cnt;
};
if (n == 1) {
cout << 0 << '\n';
return;
}
for (int i = 1; i <= 61; i++)
if (cal(i) <= d) {
cout << i << '\n';
return;
}
}
signed main() {
cin.tie(0)->sync_with_stdio(false);
cin.exceptions(cin.failbit);
int T = 1;
cin >> T;
while (T--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3396kb
input:
1 1 1 1 1 1 1 1
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'