Submission #638706

# Submission time Handle Problem Language Result Execution time Memory
638706 2022-09-07T04:32:15 Z jamezzz Self Study (JOI22_ho_t2) C++17
0 / 100
81 ms 1356 KB
#include <bits/stdc++.h>
using namespace std;

#define pf printf
#define sf scanf
typedef long long ll;
typedef pair<int,int> ii;

#define maxn 300005

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

int main(){
	sf("%d%d",&n,&m);
	for(int i=0;i<n;++i){
		sf("%d",&a[i]);
	}
	for(int i=0;i<n;++i){
		sf("%d",&b[i]);
	}
	ll lo=0,hi=1e18+10,mid,res=0;
	while(lo<=hi){
		mid=(lo+hi)>>1;
		ll rem=(ll)n*m;
		for(int i=0;i<n;++i){
			//ll take=min((ll)m,(mid+a[i]-1)/a[i]);
			//ll self=max((mid-(take*a[i])+b[i]-1)/b[i],0ll);
			ll self2=(mid+b[i]-1)/b[i];
			//rem-=min(take+self,self2);
			rem-=self2;
		}
		if(rem>=0){
			res=mid;
			lo=mid+1;
		}
		else hi=mid-1;
	}
	pf("%lld\n",res);
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:14:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  sf("%d%d",&n,&m);
      |    ^
Main.cpp:16:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   sf("%d",&a[i]);
      |     ^
Main.cpp:19:5: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   sf("%d",&b[i]);
      |     ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 224 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 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 81 ms 1356 KB Output is correct
10 Correct 56 ms 1076 KB Output is correct
11 Correct 45 ms 920 KB Output is correct
12 Correct 32 ms 732 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 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 0 ms 212 KB Output is correct
18 Incorrect 5 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 224 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 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 81 ms 1356 KB Output is correct
10 Correct 56 ms 1076 KB Output is correct
11 Correct 45 ms 920 KB Output is correct
12 Correct 32 ms 732 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 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 0 ms 212 KB Output is correct
18 Incorrect 5 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -