# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
819318 | 2023-08-10T09:22:11 Z | tset | Olympic Bus (JOI20_ho_t4) | C++14 | 1 ms | 436 KB |
#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<<50LL; int pos = 0; while(pas > 0) { int moyenneMin = pos + pas; int nbCoursesReq = 0; for(int iC : famille1) { nbCoursesReq += moyenneMin/iC; if(moyenneMin%iC != 0) { nbCoursesReq++; } } for(pair<int, int> iC : famille2 ) { int moyenneA = iC.first * M; if(moyenneA >= moyenneMin) { nbCoursesReq += moyenneMin/iC.first; if(moyenneMin%iC.first != 0) { nbCoursesReq++; } } else { nbCoursesReq += M; int nouvMoyenne = moyenneMin - moyenneA; nbCoursesReq += nouvMoyenne/iC.second; if(nouvMoyenne%iC.second != 0) { nbCoursesReq++; } } } if(nbCoursesReq <= M * N) { pos += pas; } pas/= 2; } printf("%lld\n", pos); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 340 KB | Execution killed with signal 8 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 436 KB | Execution killed with signal 8 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 340 KB | Execution killed with signal 8 |
2 | Halted | 0 ms | 0 KB | - |