# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
819363 | 2023-08-10T09:45:09 Z | tset | Self Study (JOI22_ho_t2) | C++14 | 171 ms | 13284 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<<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); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 3 ms | 468 KB | Output is correct |
11 | Correct | 171 ms | 10152 KB | Output is correct |
12 | Correct | 153 ms | 10204 KB | Output is correct |
13 | Correct | 143 ms | 9220 KB | Output is correct |
14 | Incorrect | 62 ms | 13284 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 75 ms | 4824 KB | Output is correct |
10 | Correct | 52 ms | 3020 KB | Output is correct |
11 | Correct | 38 ms | 2628 KB | Output is correct |
12 | Correct | 30 ms | 1872 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Incorrect | 1 ms | 468 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 3 ms | 468 KB | Output is correct |
11 | Correct | 171 ms | 10152 KB | Output is correct |
12 | Correct | 153 ms | 10204 KB | Output is correct |
13 | Correct | 143 ms | 9220 KB | Output is correct |
14 | Incorrect | 62 ms | 13284 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 75 ms | 4824 KB | Output is correct |
10 | Correct | 52 ms | 3020 KB | Output is correct |
11 | Correct | 38 ms | 2628 KB | Output is correct |
12 | Correct | 30 ms | 1872 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Incorrect | 1 ms | 468 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 3 ms | 468 KB | Output is correct |
11 | Correct | 171 ms | 10152 KB | Output is correct |
12 | Correct | 153 ms | 10204 KB | Output is correct |
13 | Correct | 143 ms | 9220 KB | Output is correct |
14 | Incorrect | 62 ms | 13284 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |