제출 #1063626

#제출 시각아이디문제언어결과실행 시간메모리
1063626alexdd마술쇼 (APIO24_show)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
std::vector<std::pair<int,int>> Alice()
{
    long long k = setN(5000);
    vector<pair<int,int>> edges;
    for(int i=2;i<=5000;i++)
    {
        edges.push_back({k%i+1,i+1});
    }
    return edges;
}
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
long long lca(long long x, long long y)
{
    return x/__gcd(x,y)*y;
}
long long Bob(std::vector<std::pair<int,int>> edges)
{
    long long rest=0,mult=1;
    for(auto [x,y]:edges)
    {
        int m=y-1;
        int r=x-1;
        while(rest%m!=r)
            rest+=mult;
        mult = lca(mult,m);
    }
    return rest;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...