QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#593456#6558. Allergen Testingticking_away#WA 3ms3804kbC++201.7kb2024-09-27 14:12:492024-09-27 14:12:49

Judging History

你现在查看的是最新测评结果

  • [2024-09-27 14:12:49]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3804kb
  • [2024-09-27 14:12:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using ull = unsigned long long;
using ll = long long;
#define endl '\n'
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int maxn = 2e5 + 10;
const int mod = 1000000007;
#define inl inline
#define fr(i, a, b) for (int i = a; i <= b; i++)
#define ford(i, a, b) for (int i = a; i >= b; i--)
#define forall(i, a) for (auto &i : a)

/**
   ____         ___ _____
  / ___| _   _ / _ \___ /
  \___ \| | | | | | ||_ \
   ___) | |_| | |_| |__) |
  |____/ \__, |\___/____/
         |___/
*/
istream &operator>>(istream &in, vector<int> &v)
{
    for (auto &i : v)
        in >> i;
    return in;
}
ostream &operator<<(ostream &out, vector<int> &v)
{
    for (auto &i : v)
        out << i << " ";
    return out;
}
bool _output = 1;

#define int ll
void solve()
{
    int n, d;
    cin >> n >> d;
    auto get = [&](int x)
    {
        int mx = 0;
        for (int i = 0; i < 60; i++)
        {
            if ((1ll < i) & x)
            {
                mx = i;
            }
        }
        return 1ll << mx;
    };
    int ans = log(n) / log(d + 1);
    int f_ans = (int)(ans);
    auto make = [&](int x, int p)
    {
        __int128_t res = 1;
        fr(j, 1, p)
        {
            res = res * x;
        }
        return res;
    };
    fr(i, max(0ll, f_ans - 1), f_ans + 1)
    {
        if (make(d + 1, i) >= n)
        {
            cout << i << endl;
            return;
        }
    }
    assert(1);
}

// 十字

// 4条
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    if (_output)
        cin >> _;
    while (_--)
        solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3804kb

input:

1
4 1

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 3796kb

input:

10000
1 1
1000000000000000000 1
1 1000000000000000000
1000000000000000000 1000000000000000000
26615519354743225 163142634
26615519354743225 163142634
26615519354743224 163142634
26615519354743226 163142634
847997831064072529 920867976
847997831064072529 920867976
847997831064072528 920867976
8479978...

output:

0
60
0
1
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
2
2
2
3
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
4
3
3
3
3
3
3
4
3
3
3
4
3
3
3
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
4
4
4
5
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
6
5
5
5
5
5
5
6
5...

result:

wrong answer 72nd lines differ - expected: '4', found: '3'