답안 #632610

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
632610 2022-08-20T12:16:28 Z Richem Self Study (JOI22_ho_t2) C++14
0 / 100
568 ms 11132 KB
#include <iostream>
#define int long long
 
using namespace std;
 
const int MAX_COURS = 3e5+42, INF = 1e18;
 
int nbCours, nbSemaine;
 
int cours[MAX_COURS][2];
 
void input() {
	cin >> nbCours >> nbSemaine;
 
	for(int k = 0; k < 2; k++) {
		for(int i = 0; i < nbCours; i++)
			cin >> cours[i][k];
	}
}
 
int calc(int petit, int grand) {
	int rep = grand / petit;
 
	if(grand % petit != 0)
		rep++;
	return rep;
}

int nbRestant[MAX_COURS];
bool possible(int k) {
	int nbDispo = nbCours * nbSemaine;
 
	for(int cur = 0; cur < nbCours; cur++) {
		int truc = max(cours[cur][0], cours[cur][1]);
		int nbUtilise = min(nbSemaine, calc(truc, k));
		nbDispo -= nbUtilise;
		nbRestant[cur] = k - nbUtilise * truc;
	}
	
 
	for(int cur = 0; cur < nbCours; cur++) {
		if(nbRestant[cur] <= 0) continue;
		nbDispo -= calc(cours[cur][1], nbRestant[cur]);
	}
 
	return nbDispo >= 0ll;
}
 
int dicho(int deb, int fin) {
	while(deb < fin) {
		int milieu = (deb + fin+1) / 2;
 
		if(possible(milieu))
			deb = milieu;
		else
			fin = milieu-1;
	}
 
	return deb;
}
 
signed main() {
	input();
	cout << dicho(0, INF);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 8 ms 600 KB Output is correct
11 Correct 393 ms 7964 KB Output is correct
12 Correct 395 ms 7968 KB Output is correct
13 Correct 366 ms 7968 KB Output is correct
14 Incorrect 568 ms 11132 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 304 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 205 ms 4460 KB Output is correct
10 Correct 133 ms 3272 KB Output is correct
11 Correct 120 ms 2600 KB Output is correct
12 Correct 80 ms 2252 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 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 Incorrect 10 ms 480 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 8 ms 600 KB Output is correct
11 Correct 393 ms 7964 KB Output is correct
12 Correct 395 ms 7968 KB Output is correct
13 Correct 366 ms 7968 KB Output is correct
14 Incorrect 568 ms 11132 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 304 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 205 ms 4460 KB Output is correct
10 Correct 133 ms 3272 KB Output is correct
11 Correct 120 ms 2600 KB Output is correct
12 Correct 80 ms 2252 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 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 Incorrect 10 ms 480 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 8 ms 600 KB Output is correct
11 Correct 393 ms 7964 KB Output is correct
12 Correct 395 ms 7968 KB Output is correct
13 Correct 366 ms 7968 KB Output is correct
14 Incorrect 568 ms 11132 KB Output isn't correct
15 Halted 0 ms 0 KB -