| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 996656 | faqinyeager | Self Study (JOI22_ho_t2) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, m;
vector<ll> a, b, r;
ll gcd(ll a, ll b){
if(b == 0) return a;
return gcd(b, a % b);
}
ll lcm(ll a, ll b){ return a / gcd(a, b) * b; }
int main(){
cin >> n >> m;
a.resize(n);
b.resize(n);
r.resize(n);
for(int i = 0; i < n; i++) cin >> a[i];
for(int i = 0; i < n; i++) cin >> b[i];
ll tmp = 1;
for(int i = 0; i < n; i++) tmp = lcm(tmp, a[i]);
ll tot = n * m, c = 0;
for(int i = 0; i < n; i++){
r[i] = tmp / a[i];
c += r[i];
}
ll per = tot / c, ans = 1e10;
for(int i = 0; i < n; i++){
r[i] *= per;
ans = min(ans, r[i] * a[i]);
}
cout << ans;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
