# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
819320 | 2023-08-10T09:22:44 Z | tset | Self Study (JOI22_ho_t2) | C++14 | 225 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<<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 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 388 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 2 ms | 468 KB | Output is correct |
11 | Correct | 128 ms | 10156 KB | Output is correct |
12 | Correct | 136 ms | 10212 KB | Output is correct |
13 | Correct | 133 ms | 9200 KB | Output is correct |
14 | Incorrect | 225 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 | 63 ms | 4820 KB | Output is correct |
10 | Correct | 42 ms | 3024 KB | Output is correct |
11 | Correct | 32 ms | 2624 KB | Output is correct |
12 | Correct | 25 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 | Correct | 3 ms | 468 KB | Output is correct |
19 | Correct | 3 ms | 564 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Incorrect | 214 ms | 10340 KB | Output isn't correct |
22 | 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 | 1 ms | 388 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 2 ms | 468 KB | Output is correct |
11 | Correct | 128 ms | 10156 KB | Output is correct |
12 | Correct | 136 ms | 10212 KB | Output is correct |
13 | Correct | 133 ms | 9200 KB | Output is correct |
14 | Incorrect | 225 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 | 63 ms | 4820 KB | Output is correct |
10 | Correct | 42 ms | 3024 KB | Output is correct |
11 | Correct | 32 ms | 2624 KB | Output is correct |
12 | Correct | 25 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 | Correct | 3 ms | 468 KB | Output is correct |
19 | Correct | 3 ms | 564 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Incorrect | 214 ms | 10340 KB | Output isn't correct |
22 | 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 | 1 ms | 388 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 2 ms | 468 KB | Output is correct |
11 | Correct | 128 ms | 10156 KB | Output is correct |
12 | Correct | 136 ms | 10212 KB | Output is correct |
13 | Correct | 133 ms | 9200 KB | Output is correct |
14 | Incorrect | 225 ms | 13284 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |