답안 #819310

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819310 2023-08-10T09:17:30 Z tset Self Study (JOI22_ho_t2) C++14
0 / 100
306 ms 17124 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 = 1073741824LL*1073741824LL;
    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

Main.cpp: In function 'int main()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%lld%lld", &N, &M);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~
Main.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%lld", &Ai[ai]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%lld", &Bi[bi]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 3 ms 584 KB Output is correct
11 Correct 156 ms 16040 KB Output is correct
12 Correct 156 ms 16048 KB Output is correct
13 Correct 168 ms 13116 KB Output is correct
14 Incorrect 306 ms 17124 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 ms 212 KB Output is correct
8 Correct 0 ms 324 KB Output is correct
9 Correct 82 ms 7740 KB Output is correct
10 Correct 51 ms 4932 KB Output is correct
11 Correct 39 ms 4080 KB Output is correct
12 Correct 36 ms 3020 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 300 KB Output is correct
16 Correct 1 ms 300 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Incorrect 5 ms 492 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 3 ms 584 KB Output is correct
11 Correct 156 ms 16040 KB Output is correct
12 Correct 156 ms 16048 KB Output is correct
13 Correct 168 ms 13116 KB Output is correct
14 Incorrect 306 ms 17124 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 ms 212 KB Output is correct
8 Correct 0 ms 324 KB Output is correct
9 Correct 82 ms 7740 KB Output is correct
10 Correct 51 ms 4932 KB Output is correct
11 Correct 39 ms 4080 KB Output is correct
12 Correct 36 ms 3020 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 300 KB Output is correct
16 Correct 1 ms 300 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Incorrect 5 ms 492 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 3 ms 584 KB Output is correct
11 Correct 156 ms 16040 KB Output is correct
12 Correct 156 ms 16048 KB Output is correct
13 Correct 168 ms 13116 KB Output is correct
14 Incorrect 306 ms 17124 KB Output isn't correct
15 Halted 0 ms 0 KB -