Submission #914973

#TimeUsernameProblemLanguageResultExecution timeMemory
914973ReLiceSelf Study (JOI22_ho_t2)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define str string #define ins insert #define ld long double #define pb push_back #define pf push_front #define pof pop_front() #define pob pop_back() #define lb lower_bound #define ub upper_bound #define endl "\n" #define fr first #define sc second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define sz size() #define vll vector<ll> #define bc back() #define arr array #define pll vector<pair<ll,ll>> using namespace std; template <class _T> bool chmin(_T &x, const _T &y){ bool f=0; if (x>y){x=y;f=1;} return f; } template <class _T> bool chmax(_T &x, const _T &y){ bool f=0; if (x<y){x=y;f=1;} return f; } //void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);} void start(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const ll inf=2e18+7; const ll mod=1e9+7; const ll N=1e5+7; const ld eps=1e-9; istream& operator>>( istream& src, __int128_t& value) { long long v;src>>v; value = (ll)v; return src; } void solve(){ ll i,j; ll n,m;cin>>n>>m; vi a(n);rep(i,0,n)cin>>a[i]; vi b(n);rep(i,0,n)cin>>b[i]; rep(i,0,n)a[i]=max(a[i],b[i]); if(m==1){ ll ans=inf; for(i=0;i<n;i++) ans=min(ans,a[i]); cout<<ans<<endl; return; } ll lo = 0; ll hi = 2e18; while(lo+1<hi){ ll mid = lo+(hi-lo)/2; ll cost = 0; for(i=0;i<n;i++) { ll inclass = (mid+a[i]-1)/a[i]; if(inclass>m){ inclass=m; ll outclass = (mid-inclass*a[i]+b[i]-1)/b[i]; cost+=outclass; } cost+=inclass; } if(cost<=n*m) lo=mid; else hi=mid; } cout<<lo<<endl; } signed main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); ll t=1; //cin>>t; while(t--) solve(); return 0; } /* */

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:53:2: error: 'vi' was not declared in this scope; did you mean 'i'?
   53 |  vi a(n);rep(i,0,n)cin>>a[i];
      |  ^~
      |  i
Main.cpp:53:10: error: 'rep' was not declared in this scope
   53 |  vi a(n);rep(i,0,n)cin>>a[i];
      |          ^~~
Main.cpp:54:4: error: expected ';' before 'b'
   54 |  vi b(n);rep(i,0,n)cin>>b[i];
      |    ^~
      |    ;
Main.cpp:58:38: error: 'a' was not declared in this scope
   58 |         for(i=0;i<n;i++) ans=min(ans,a[i]);
      |                                      ^
Main.cpp:68:31: error: 'a' was not declared in this scope
   68 |             ll inclass = (mid+a[i]-1)/a[i];
      |                               ^
Main.cpp:71:49: error: 'b' was not declared in this scope
   71 |                 ll outclass = (mid-inclass*a[i]+b[i]-1)/b[i];
      |                                                 ^
Main.cpp:51:10: warning: unused variable 'j' [-Wunused-variable]
   51 |     ll i,j;
      |          ^