답안 #756547

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
756547 2023-06-11T21:16:15 Z michao Self Study (JOI22_ho_t2) C++14
0 / 100
474 ms 5000 KB
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int MAX=3e5+5;
const int inf=(int)1e18+9;
int a[MAX],b[MAX];
int n,m;
int gora(int x,int y){
  if (x%y==0)return x/y;
  return x/y+1;
}
bool check(int mid){
  int balans=0;
  for (int i=1;i<=n;i++){
    int wale=max(a[i],b[i]);
    int need=gora(mid,wale);
    if (need<=m)balans+=m-need;
    else{
      int sum=mid-wale*m;
      assert(sum>=0LL);
      int odejmij=gora(sum,b[i]);
      balans-=odejmij;
    }
  }
  return balans>=0;
}
int32_t main()
{
  BOOST;
  cin>>n>>m;
  for (int i=1;i<=n;i++)cin>>a[i];
  for (int i=1;i<=n;i++)cin>>b[i];
  int ip=0,ik=inf;
  while (ip+1<ik){
    int mid=(ip+ik)>>1;
    if (check(mid))ip=mid;
    else ik=mid;
  }
  cout<<ip;
  return 0;
}
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 226 ms 4988 KB Output is correct
12 Correct 217 ms 4892 KB Output is correct
13 Correct 232 ms 5000 KB Output is correct
14 Incorrect 474 ms 5000 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 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 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 114 ms 2664 KB Output is correct
10 Correct 77 ms 1880 KB Output is correct
11 Correct 58 ms 1492 KB Output is correct
12 Correct 49 ms 1268 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 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 9 ms 408 KB Output isn't correct
19 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 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 226 ms 4988 KB Output is correct
12 Correct 217 ms 4892 KB Output is correct
13 Correct 232 ms 5000 KB Output is correct
14 Incorrect 474 ms 5000 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 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 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 114 ms 2664 KB Output is correct
10 Correct 77 ms 1880 KB Output is correct
11 Correct 58 ms 1492 KB Output is correct
12 Correct 49 ms 1268 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 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 9 ms 408 KB Output isn't correct
19 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 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 226 ms 4988 KB Output is correct
12 Correct 217 ms 4892 KB Output is correct
13 Correct 232 ms 5000 KB Output is correct
14 Incorrect 474 ms 5000 KB Output isn't correct
15 Halted 0 ms 0 KB -