Submission #534137

#TimeUsernameProblemLanguageResultExecution timeMemory
534137Paul_Liao_1457Self Study (JOI22_ho_t2)C++17
Compilation error
0 ms0 KiB
// 還要更強 #include<iostream> #include<queue> #include<set> #include<map> #include<iomanip> #include<math.h> #include<cstring> #include<stack> #include<string.h> #include<random> #include<algorithm> #include<vector> #define ll long long #define int __int_128 #define FOR(i,a,b) for(ll i=a;i<b;i++) #define REP(i,a,b) for(int i=a;i>=b;i--) #define INF (ll)(2e18) #define pb push_back #define F first #define S second using namespace std; ll n,m; ll A[300005],B[300005]; bool check(ll x){ ll res=0; FOR(i,0,n){ int tmp=x; if(1ll*A[i]*m<tmp){ tmp-=A[i]*m; res-=tmp/B[i]+(tmp%B[i]?1:0); } else{ int used=(tmp-1)/A[i]+1; res+=m-used; } } if(res>=0) return 1; return 0; } signed main(){ cin>>n>>m; FOR(i,0,n){ cin>>A[i]; } FOR(i,0,n){ cin>>B[i]; A[i]=max(A[i],B[i]); } int l=0,r=(1e18+1),ans=0; while(l<r){ int mid=(l+r)>>1; if(check(mid)){ ans=max(ans,mid); l=mid+1; } else{ r=mid; } } cout<<ans<<endl; }

Compilation message (stderr)

Main.cpp: In function 'bool check(long long int)':
Main.cpp:16:13: error: '__int_128' was not declared in this scope; did you mean '__rintf128'?
   16 | #define int __int_128
      |             ^~~~~~~~~
Main.cpp:32:9: note: in expansion of macro 'int'
   32 |         int tmp=x;
      |         ^~~
Main.cpp:33:23: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   33 |         if(1ll*A[i]*m<tmp){
      |                       ^~~
      |                       tm
Main.cpp:38:17: error: expected ';' before 'used'
   38 |             int used=(tmp-1)/A[i]+1;
      |                 ^~~~
Main.cpp:39:20: error: 'used' was not declared in this scope
   39 |             res+=m-used;
      |                    ^~~~
Main.cpp: In function 'int main()':
Main.cpp:16:13: error: '__int_128' was not declared in this scope; did you mean '__rintf128'?
   16 | #define int __int_128
      |             ^~~~~~~~~
Main.cpp:54:5: note: in expansion of macro 'int'
   54 |     int l=0,r=(1e18+1),ans=0;
      |     ^~~
Main.cpp:55:11: error: 'l' was not declared in this scope
   55 |     while(l<r){
      |           ^
Main.cpp:55:13: error: 'r' was not declared in this scope
   55 |     while(l<r){
      |             ^
Main.cpp:56:13: error: expected ';' before 'mid'
   56 |         int mid=(l+r)>>1;
      |             ^~~
Main.cpp:57:18: error: 'mid' was not declared in this scope
   57 |         if(check(mid)){
      |                  ^~~
Main.cpp:58:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   58 |             ans=max(ans,mid); l=mid+1;
      |             ^~~
      |             abs
Main.cpp:64:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   64 |     cout<<ans<<endl;
      |           ^~~
      |           abs