QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#408685#5103. Fair DivisionberarchegasWA 1ms3560kbC++141.3kb2024-05-10 21:17:242024-05-10 21:17:25

Judging History

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

  • [2024-05-10 21:17:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3560kb
  • [2024-05-10 21:17:24]
  • 提交

answer

#include <bits/stdc++.h>
#define O_O
using namespace std;
using ll = long long;
#define int ll
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ff first
#define ss second
mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());
    
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 5;
const int INF = 1e9;

int n, m;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>> n>> m;

    vector<int> vec{1};
    for(int a=2;; a++)
    {
        bool passou = false;
        __int128 pa = 1;
        for(int i=0; i<n; i++)
        {
            pa *= a;
            if(pa - vec.back() > m)
            {
                passou = true;
                break;
            } 
        }
        if(passou)
            break;
        // cout<< a<< " "<< (long long)pa<< endl;
        vec.push_back(pa);
    }
    for(int i=0; i<vec.size(); i++)
    {
        for(int j=i-1; j>=0; j--)
        {
            int qn = vec[i], qmpn = vec[j];
            int q = i+1;
            int qmp = j+1;
            int p = q - qmp;
            if(m % (qn - qmpn) == 0)
            {
                cout<< p<< " "<< q<< "\n";
                return 0;
            }
        }
    }
    cout<< "impossible\n";

    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3560kb

input:

13 382475111752106101

output:

impossible

result:

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