Submission #3027104
Source Code Expand
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部0にする
vector<ll> G[100005];
vector<P> tree[100010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll>> pqls;
priority_queue <P,vector<P>,greater<P>> pqps;
//small priority queue
//top pop
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
ll rui(ll abc,ll bed){
//aのb乗を計算する
if(bed==0){return 1;}
else{
ll ced = rui(abc,bed/2);
ced *= ced;
ced %= mod;
if(bed%2==1){ced*=abc; ced%=mod;}
return ced;
}
}
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans;
ll a,b,d,e,f,g,h,w;
ll x[800005],y[800005],z[900005];
char s[500005];
int main(){
cin>>n>>a>>b;
while(true){
if(a==b){
p(ans);
return 0;
}else if(a>b){
p(-1);
return 0;
}else{
b /= 2;
ans ++;
}
}
}
Submission Info
Submission Time |
|
Task |
B - Camphor Tree |
User |
enjapma |
Language |
C++14 (GCC 5.4.1) |
Score |
100 |
Code Size |
1616 Byte |
Status |
AC |
Exec Time |
4 ms |
Memory |
6528 KB |
Judge Result
Set Name |
All |
Score / Max Score |
100 / 100 |
Status |
|
Set Name |
Test Cases |
All |
00_sample, 01_sample, 02_sample, max_01, max_02, max_03, max_04, max_05, max_06, max_07, max_08, max_09, min_00 |
Case Name |
Status |
Exec Time |
Memory |
00_sample |
AC |
3 ms |
6528 KB |
01_sample |
AC |
3 ms |
6528 KB |
02_sample |
AC |
3 ms |
6528 KB |
max_01 |
AC |
3 ms |
6528 KB |
max_02 |
AC |
3 ms |
6528 KB |
max_03 |
AC |
3 ms |
6528 KB |
max_04 |
AC |
4 ms |
6528 KB |
max_05 |
AC |
3 ms |
6528 KB |
max_06 |
AC |
3 ms |
6528 KB |
max_07 |
AC |
3 ms |
6528 KB |
max_08 |
AC |
3 ms |
6528 KB |
max_09 |
AC |
3 ms |
6528 KB |
min_00 |
AC |
3 ms |
6528 KB |