# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
819363 | tset | Self Study (JOI22_ho_t2) | C++14 | 171 ms | 13284 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int N, M;
scanf("%lld%lld", &N, &M);
vector<int> Ai(N), Bi(N);
for(int ai = 0; ai < N; ai++)
{
scanf("%lld", &Ai[ai]);
}
for(int bi = 0; bi< N; bi++)
{
scanf("%lld", &Bi[bi]);
}
vector<int> famille1;
vector<pair<int, int>> famille2;
for(int iN = 0; iN < N; iN++)
{
if(Bi[iN] >= Ai[iN])
{
famille1.push_back(Bi[iN]);
}
else
{
famille2.push_back({Ai[iN], Bi[iN]});
}
}
int pas = 1LL<<60LL;
int pos = 0;
while(pas > 0)
{
int ptsMin = pos + pas;
if(ptsMin > 1LL<<60LL)
{
pas/=2;
continue;
}
int nbCoursesReq = 0;
for(int iC : famille1)
{
nbCoursesReq += ptsMin/iC;
if(ptsMin%iC != 0)
{
nbCoursesReq++;
}
}
for(pair<int, int> iC : famille2 )
{
int ptsA = iC.first * M;
if(ptsA >= ptsMin)
{
nbCoursesReq += ptsMin/iC.first;
if(ptsMin%iC.first != 0)
{
nbCoursesReq++;
}
}
else
{
nbCoursesReq += M;
int ptsRest = ptsMin - ptsA;
nbCoursesReq += ptsRest/iC.second;
if(ptsRest%iC.second != 0)
{
nbCoursesReq++;
}
}
}
if(nbCoursesReq <= M * N)
{
pos += pas;
}
pas/= 2;
}
printf("%lld\n", pos);
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |