QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#89913#5103. Fair Division_skb_#WA 2ms3504kbC++20942b2023-03-21 19:28:482023-03-21 19:28:52

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-21 19:28:52]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3504kb
  • [2023-03-21 19:28:48]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

__int128_t bp(__int128_t a, __int128_t p) {
    if (p == 0) return 1LL;
    __int128_t ret = bp(a, p / 2);
    ret *= ret;
    if (p & 1) ret *= a;
    return ret;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    long long nn, mm; cin >> nn >> mm;
    __int128_t n = nn, m = mm;

    int max_pow = pow(1e19, 1.0 / n);
    __int128_t pw[max_pow + 1];
    pw[0] = 1;
    // cout << max_pow << ' ' << nn << '\n';
    for (int i = 1; i <= max_pow; ++i) pw[i] = bp(i, n);

    for (__int128_t q = 1; q <= max_pow; ++q) {
        for (__int128_t p = 1; p <= max_pow; ++p) {
            if (p < q)
                if (m % (pw[q] - pw[q - p]) == 0) {
                    cout << (long long) p << ' ' 
                        << (long long) q << '\n';
                    return 0;
                }
        }
    }
    cout << "impossible\n";
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3504kb

input:

13 382475111752106101

output:

impossible

result:

wrong answer 1st lines differ - expected: '17 28', found: 'impossible'