답안 #588077

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
588077 2022-07-02T17:09:20 Z Mounir Self Study (JOI22_ho_t2) C++14
62 / 100
136 ms 11340 KB
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define print(x) cout << #x << " est " << x << endl;
#define x first
#define y second
#define int long long
using namespace std;
 
const signed N = 1e6;
signed nCours, nWeeks;
int a[N], b[N];
 
inline bool isOk(int bInf){
      signed aAllouer = 0;
      for (signed iCours = 0; iCours < nCours; ++iCours){
            signed besoin = ceil(bInf/(long double)a[iCours]);
            if (besoin <= nWeeks)
                  aAllouer += nWeeks - besoin;
            else
                  aAllouer -= ceil((bInf - nWeeks * a[iCours])/(long double)b[iCours]);
      }
 
    //  cout << aAllouer
      return aAllouer >= 0;
}
 
signed main(){ 
      scanf("%d%d", &nCours, &nWeeks);
      for (signed i = 0; i < nCours; ++i)
            scanf("%lld", &a[i]);
      for (signed i = 0; i < nCours; ++i){
            scanf("%lld", &b[i]);
            chmax(a[i], b[i]);
      }
 
      int gauche = 0, droite = nWeeks * 1e9;
      while (droite > gauche){
            int mid = (gauche + droite)/2 + 1;
            if (isOk(mid))
                  gauche = mid;
            else
                  droite = mid - 1;
      }
      printf("%lld\n", gauche);
      return 0;   
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:33:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |       scanf("%d%d", &nCours, &nWeeks);
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:35:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |             scanf("%lld", &a[i]);
      |             ~~~~~^~~~~~~~~~~~~~~
Main.cpp:37:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |             scanf("%lld", &b[i]);
      |             ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 1 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 2 ms 380 KB Output is correct
11 Correct 95 ms 4992 KB Output is correct
12 Correct 94 ms 4936 KB Output is correct
13 Correct 83 ms 4908 KB Output is correct
14 Correct 83 ms 4888 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 136 ms 4992 KB Output is correct
17 Correct 100 ms 11340 KB Output is correct
18 Correct 105 ms 10748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 136 ms 4992 KB Output is correct
3 Correct 100 ms 11340 KB Output is correct
4 Correct 105 ms 10748 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 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 64 ms 2640 KB Output is correct
14 Correct 35 ms 1868 KB Output is correct
15 Correct 28 ms 1480 KB Output is correct
16 Correct 24 ms 1200 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 2 ms 468 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 1 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 2 ms 380 KB Output is correct
11 Correct 95 ms 4992 KB Output is correct
12 Correct 94 ms 4936 KB Output is correct
13 Correct 83 ms 4908 KB Output is correct
14 Correct 83 ms 4888 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 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 64 ms 2640 KB Output is correct
24 Correct 35 ms 1868 KB Output is correct
25 Correct 28 ms 1480 KB Output is correct
26 Correct 24 ms 1200 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 2 ms 468 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 136 ms 4992 KB Output is correct
36 Correct 100 ms 11340 KB Output is correct
37 Correct 105 ms 10748 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 0 ms 212 KB Output is correct
41 Correct 0 ms 304 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 0 ms 308 KB Output is correct
44 Correct 0 ms 340 KB Output is correct
45 Correct 3 ms 468 KB Output is correct
46 Correct 4 ms 596 KB Output is correct
47 Correct 2 ms 348 KB Output is correct
48 Correct 21 ms 2004 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 3 ms 480 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 55 ms 5496 KB Output is correct
56 Correct 31 ms 3112 KB Output is correct
57 Correct 31 ms 3068 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 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 64 ms 2640 KB Output is correct
10 Correct 35 ms 1868 KB Output is correct
11 Correct 28 ms 1480 KB Output is correct
12 Correct 24 ms 1200 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 1 ms 212 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 468 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 136 ms 4992 KB Output is correct
22 Correct 100 ms 11340 KB Output is correct
23 Correct 105 ms 10748 KB Output is correct
24 Incorrect 27 ms 1876 KB Output isn't correct
25 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 1 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 2 ms 380 KB Output is correct
11 Correct 95 ms 4992 KB Output is correct
12 Correct 94 ms 4936 KB Output is correct
13 Correct 83 ms 4908 KB Output is correct
14 Correct 83 ms 4888 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 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 64 ms 2640 KB Output is correct
24 Correct 35 ms 1868 KB Output is correct
25 Correct 28 ms 1480 KB Output is correct
26 Correct 24 ms 1200 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 2 ms 468 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 0 ms 304 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 0 ms 308 KB Output is correct
40 Correct 0 ms 340 KB Output is correct
41 Correct 3 ms 468 KB Output is correct
42 Correct 4 ms 596 KB Output is correct
43 Correct 2 ms 348 KB Output is correct
44 Correct 21 ms 2004 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 3 ms 480 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 55 ms 5496 KB Output is correct
52 Correct 31 ms 3112 KB Output is correct
53 Correct 31 ms 3068 KB Output is correct
54 Incorrect 27 ms 1876 KB Output isn't correct
55 Halted 0 ms 0 KB -