QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#806380#9868. GCDzhangwansenTL 0ms0kbC++23772b2024-12-09 09:17:072024-12-09 09:17:08

Judging History

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

  • [2024-12-09 09:17:08]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-12-09 09:17:07]
  • 提交

answer

#include<bits/stdc++.h>
#define int unsigned  long long
#define PII pair<int,int>
using namespace std;

mt19937_64 mrand(time(0));
map<PII,int> s;

int dfs(int a,int b,int dpt,int maxn)
{
    if(dpt > maxn) return 1e9;
    if(a * b == 0) return 1;
    int GCD = __gcd(a,b);
    a /= GCD,b /= GCD;
    return min(dfs(a - 1,b,dpt + 1,maxn),dfs(a,b - 1, dpt + 1,maxn)) + 1;
}

int sum = 0;
void solve()
{
    int a ,b;
    cin >> a >> b;
    a = mrand(),b = mrand();
    

    sum += a;
    if(1e5-sum > a) return;
    cout << a << ' ' << b << endl;
    cout << dfs(a,b,0,26) << endl;
}

signed main()
{
    std::ios::sync_with_stdio(false);
    cout.tie(0);
    int t = 1;
    cin >> t;
    while(t--)
        solve();
    return 0;
}

詳細信息

Test #1:

score: 0
Time Limit Exceeded

input:

3
3 4
12 20
114 514

output:

13460776292878960662 10760337125311934968

result: