제출 #1202222

#제출 시각아이디문제언어결과실행 시간메모리
1202222BzslayedMagic Show (APIO24_show)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;

#define ll long long
#define pii pair<int, int>

// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().

vector<pii> Alice(){
    ll x = setN(5000);
    vector<pii> edges;
    for (int i=1; i<5000; i++){
        int v = x%i;
        edges.push_back({v+1, i});
    }

    return edges;
}
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second

const ll INF = 1e18;

// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().

ll Bob(vector<pii> V){
    ll ans = 0, lc = 1;
	for (auto [r, m] : V){
		r--;
        if (r > m) swap(r, m);

		while (ans%m != r) ans += lc;
		//cout << m << ' ' << r << ' ' << lc << ' '<< '\n';
		ll gc = m/gcd(m, lc);
		if (1e18 / gc < lc) break;
		lc *= gc;
    }

    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...