답안 #718562

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
718562 2023-04-04T10:12:51 Z vinnipuh01 Self Study (JOI22_ho_t2) C++17
10 / 100
76 ms 11392 KB
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <map>
#include <queue>
#define int long long
#define sqrt sqrtl

using namespace std;

const long long oo = 1000000000000000000;

long long sum, ans = 0, mx = 0, mn = 1000000000, num, pos;


/*
    ViHHiPuh

   (( `'-""``""-'` ))
     )-__-_.._-__-(
   / --- (o _ o) --- \
   \ .-* ( .0. ) *-. /
   _'-. ,_ '=' _, .-'_
  / `;#'#'# - #'#'#;` \
 \_)) -----'#'----- ((_/
      # --------- #
  '# ------- ------ #'
  /..-'# ------- #'-.\
  _\...-\'# -- #'/-.../_
  ((____)- '#' -(____))


    cout << fixed << setprecision(6) << x;


    freopen ( "sum.in", "r", stdin )
*/

int n, m, a[ 300001 ], b[ 300001 ];

bool ok( int x ) {
	sum = 0;
	for ( int i = 1; i <= n; i ++ ) {
		num = x / a[ i ];
		if ( x % a[ i ] ) {
			num ++;
		}
		if ( num <= m )
			sum += m - num;
		else {
			pos = ( num - m - 1 ) * a[ i ];
			if ( x % a[ i ] )
				pos += x % a[ i ];
			else
				pos += a[ i ];
			pos = pos / b[ i ] + (bool)( pos % b[ i ] );
			sum -= pos;
		}
	}
	return sum >= 0;
}

main () {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    cin >> m;
    for ( int i = 1; i <= n; i ++ )
    	cin >> a[ i ];
    for ( int i = 1; i <= n; i ++ ) {
    	cin >> b[ i ];
    	if ( b[ i ] > a[ i ] )
    		a[ i ] = b[ i ];
    	mn = min( mn, a[ i ] );
    }
    cout << mn;
}

Compilation message

Main.cpp:69:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   69 | main () {
      | ^~~~
# 결과 실행 시간 메모리 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 1 ms 340 KB Output is correct
11 Correct 58 ms 4944 KB Output is correct
12 Correct 54 ms 4968 KB Output is correct
13 Correct 47 ms 4900 KB Output is correct
14 Correct 50 ms 4892 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 29 ms 6092 KB Output is correct
17 Correct 76 ms 11392 KB Output is correct
18 Correct 59 ms 10788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 29 ms 6092 KB Output is correct
3 Correct 76 ms 11392 KB Output is correct
4 Correct 59 ms 10788 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 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 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 1 ms 340 KB Output is correct
11 Correct 58 ms 4944 KB Output is correct
12 Correct 54 ms 4968 KB Output is correct
13 Correct 47 ms 4900 KB Output is correct
14 Correct 50 ms 4892 KB Output is correct
15 Incorrect 0 ms 212 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 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 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 1 ms 340 KB Output is correct
11 Correct 58 ms 4944 KB Output is correct
12 Correct 54 ms 4968 KB Output is correct
13 Correct 47 ms 4900 KB Output is correct
14 Correct 50 ms 4892 KB Output is correct
15 Incorrect 0 ms 212 KB Output isn't correct
16 Halted 0 ms 0 KB -