답안 #718021

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
718021 2023-04-03T07:32:59 Z hariaakas646 Self Study (JOI22_ho_t2) C++14
35 / 100
219 ms 8552 KB
#include <bits/stdc++.h>
#include <iostream>

using namespace std;

#define scd(t) scanf("%d", &t)
#define scld(t) scanf("%ld", &t)
#define sclld(t) scanf("%lld", &t)
#define scc(t) scanf("%c", &t)
#define scs(t) scanf("%s", t)
#define scf(t) scanf("%f", &t)
#define sclf(t) scanf("%lf", &t)
#define forr(i, j, k) for (int i = j; i < k; i++)
#define frange(i, j) forr(i, 0, j)
#define all(cont) cont.begin(), cont.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long int li;
typedef unsigned long int uli;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<lli> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long double ld;

lli n, m;
bool check(lli x, vll &vec)
{
    lli tot = 0;
    for (auto e : vec)
    {
        tot += (x + e - 1) / e;
    }
    return tot <= n * m;
}

int main()
{

    sclld(n);
    sclld(m);
    lli mi = 1e15;
    vll vec(n);
    frange(i, n)
    {
        sclld(vec[i]);
    }
    frange(i, n)
    {
        lli a;
        sclld(a);
        vec[i] = max(vec[i], a);
    }
    mi = *min_element(all(vec));
    lli hi = (mi * m) * n;
    lli lo = 0;
    while (hi != lo)
    {
        lli mid = (hi + lo + 1) / 2;
        if (check(mid, vec))
        {
            lo = mid;
        }
        else
        {
            hi = mid - 1;
        }
    }
    printf("%lld", lo);
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:8:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 | #define sclld(t) scanf("%lld", &t)
      |                  ~~~~~^~~~~~~~~~~~
Main.cpp:50:5: note: in expansion of macro 'sclld'
   50 |     sclld(n);
      |     ^~~~~
Main.cpp:8:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 | #define sclld(t) scanf("%lld", &t)
      |                  ~~~~~^~~~~~~~~~~~
Main.cpp:51:5: note: in expansion of macro 'sclld'
   51 |     sclld(m);
      |     ^~~~~
Main.cpp:8:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 | #define sclld(t) scanf("%lld", &t)
      |                  ~~~~~^~~~~~~~~~~~
Main.cpp:56:9: note: in expansion of macro 'sclld'
   56 |         sclld(vec[i]);
      |         ^~~~~
Main.cpp:8:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 | #define sclld(t) scanf("%lld", &t)
      |                  ~~~~~^~~~~~~~~~~~
Main.cpp:61:9: note: in expansion of macro 'sclld'
   61 |         sclld(a);
      |         ^~~~~
# 결과 실행 시간 메모리 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 0 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 340 KB Output is correct
11 Correct 121 ms 2644 KB Output is correct
12 Correct 115 ms 2644 KB Output is correct
13 Correct 127 ms 2644 KB Output is correct
14 Correct 122 ms 2644 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 69 ms 2644 KB Output is correct
17 Correct 134 ms 2644 KB Output is correct
18 Correct 98 ms 2644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 69 ms 2644 KB Output is correct
3 Correct 134 ms 2644 KB Output is correct
4 Correct 98 ms 2644 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 1 ms 256 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 53 ms 4280 KB Output is correct
14 Correct 35 ms 2996 KB Output is correct
15 Correct 25 ms 2288 KB Output is correct
16 Correct 22 ms 1924 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 296 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 308 KB Output is correct
23 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 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 0 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 340 KB Output is correct
11 Correct 121 ms 2644 KB Output is correct
12 Correct 115 ms 2644 KB Output is correct
13 Correct 127 ms 2644 KB Output is correct
14 Correct 122 ms 2644 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 0 ms 212 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 300 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 53 ms 4280 KB Output is correct
24 Correct 35 ms 2996 KB Output is correct
25 Correct 25 ms 2288 KB Output is correct
26 Correct 22 ms 1924 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 296 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
33 Correct 3 ms 340 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 69 ms 2644 KB Output is correct
36 Correct 134 ms 2644 KB Output is correct
37 Correct 98 ms 2644 KB Output is correct
38 Correct 1 ms 292 KB Output is correct
39 Correct 1 ms 296 KB Output is correct
40 Incorrect 1 ms 212 KB Output isn't correct
41 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 0 ms 212 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 53 ms 4280 KB Output is correct
10 Correct 35 ms 2996 KB Output is correct
11 Correct 25 ms 2288 KB Output is correct
12 Correct 22 ms 1924 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 296 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 308 KB Output is correct
19 Correct 3 ms 340 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 69 ms 2644 KB Output is correct
22 Correct 134 ms 2644 KB Output is correct
23 Correct 98 ms 2644 KB Output is correct
24 Correct 30 ms 1568 KB Output is correct
25 Correct 75 ms 3900 KB Output is correct
26 Correct 13 ms 1168 KB Output is correct
27 Correct 96 ms 8396 KB Output is correct
28 Correct 106 ms 8392 KB Output is correct
29 Correct 109 ms 8388 KB Output is correct
30 Correct 142 ms 8524 KB Output is correct
31 Correct 211 ms 8552 KB Output is correct
32 Incorrect 219 ms 3812 KB Output isn't correct
33 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 0 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 340 KB Output is correct
11 Correct 121 ms 2644 KB Output is correct
12 Correct 115 ms 2644 KB Output is correct
13 Correct 127 ms 2644 KB Output is correct
14 Correct 122 ms 2644 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 0 ms 212 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 300 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 53 ms 4280 KB Output is correct
24 Correct 35 ms 2996 KB Output is correct
25 Correct 25 ms 2288 KB Output is correct
26 Correct 22 ms 1924 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 296 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
33 Correct 3 ms 340 KB Output is correct
34 Correct 1 ms 292 KB Output is correct
35 Correct 1 ms 296 KB Output is correct
36 Incorrect 1 ms 212 KB Output isn't correct
37 Halted 0 ms 0 KB -