이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define int long long
void solve(){
int n, m;
cin >> n >> m;
int a[n], b[n];
for(int i=0; i< n; i++)cin >> a[i];
for(int i=0; i< n; i++)cin >> b[i];
int l=0; int r=1e18+1;
int ans=0;
if(m==1){
ans=1e18;
for(int i=0; i< n; i++){
ans=min(ans, max(a[i], b[i]));
}
cout << ans << '\n';
return;
}
set<pair<int, int>> st;
for(int i=0; i< n; i++){
st.insert({0, i});
}
for(int i=0; i<n*m; i++){
pair<int, int> k=*st.begin();
st.erase(k);
st.insert({k.F+a[k.S], k.S});
}
cout << (*st.begin()).F << '\n';
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
solve();
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'void solve()':
Main.cpp:21:6: warning: unused variable 'l' [-Wunused-variable]
21 | int l=0; int r=1e18+1;
| ^
Main.cpp:21:15: warning: unused variable 'r' [-Wunused-variable]
21 | int l=0; int r=1e18+1;
| ^
# | 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... |