Submission #17457181


Source Code Expand

Copy
#include<bits/stdc++.h>
#include<iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define ar array
#define all(a) a.begin(),a.end() 
#define Unique(a)        a.erase(unique(all(a)), a.end())
#define mod 1000000007
#define ld long double
#define wi(x)       cerr << #x << " is " << x << '\n';
#define pb push_back
#define mxn 200005
#define inf 1e18
#define fi first
#define se second
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ord_set;
void solve(){				
	ll x,y,a,b,s1=0,s2,ans=0;
	cin>>x>>y>>a>>b;
	ll t1=x;
	while(t1<y){
		s2=(y-t1)/b;
		if((y-t1)%b==0)
		--s2;
		ans=max(ans,s1+s2);
		s1++;
		if(inf/t1<a)
		break;
		else
		t1*=a;
	} 
	cout<<ans;
}
int main(void){
	fast;
	solve();                        		                       
}

Submission Info

Submission Time
Task D - Takahashi Unevolved
User VoidHead
Language C++ (GCC 9.2.1)
Score 400
Code Size 998 Byte
Status AC
Exec Time 8 ms
Memory 3644 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 31
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All hand_01.txt, max_01.txt, max_02.txt, max_03.txt, max_04.txt, max_05.txt, max_06.txt, max_07.txt, max_08.txt, max_09.txt, max_10.txt, max_11.txt, max_12.txt, max_13.txt, max_14.txt, max_15.txt, max_16.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
hand_01.txt AC 8 ms 3524 KB
max_01.txt AC 2 ms 3604 KB
max_02.txt AC 1 ms 3536 KB
max_03.txt AC 2 ms 3472 KB
max_04.txt AC 2 ms 3512 KB
max_05.txt AC 3 ms 3484 KB
max_06.txt AC 2 ms 3580 KB
max_07.txt AC 2 ms 3580 KB
max_08.txt AC 2 ms 3536 KB
max_09.txt AC 3 ms 3608 KB
max_10.txt AC 2 ms 3576 KB
max_11.txt AC 2 ms 3580 KB
max_12.txt AC 2 ms 3600 KB
max_13.txt AC 2 ms 3580 KB
max_14.txt AC 2 ms 3604 KB
max_15.txt AC 2 ms 3628 KB
max_16.txt AC 2 ms 3536 KB
random_01.txt AC 2 ms 3508 KB
random_02.txt AC 2 ms 3644 KB
random_03.txt AC 2 ms 3468 KB
random_04.txt AC 2 ms 3608 KB
random_05.txt AC 2 ms 3604 KB
random_06.txt AC 2 ms 3472 KB
random_07.txt AC 2 ms 3484 KB
random_08.txt AC 2 ms 3532 KB
random_09.txt AC 1 ms 3524 KB
random_10.txt AC 2 ms 3632 KB
random_11.txt AC 2 ms 3560 KB
random_12.txt AC 2 ms 3580 KB
sample_01.txt AC 2 ms 3580 KB
sample_02.txt AC 3 ms 3600 KB