Submission #1114783
Source Code Expand
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
typedef long long ll;
const ll INF=1<<28;
const ll LINF=1ll<<61;
//My own input/output stream
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putsp()
#define putii(x,y) puti(x),putnum(y),putsp()
#define putiii(x,y,z) putii(x,y),putnum(z),putsp()
#define putsi(x) putnum(x),putendl()
#define putsii(x,y) puti(x),putnum(y),putendl()
#define putsiii(x,y,z) putii(x,y),putnum(z),putendl()
inline ll getnum()
{
register ll r=0;register bool ng=0;register char c;c=getchar();
while(c!='-'&&(c<'0'||c>'9'))c=getchar();
if(c=='-')ng=1,c=getchar();
while(c>='0'&&c<='9')r=r*10+c-'0',c=getchar();
if(ng)r=-r;return r;
}
template <class T> inline void putnum(T x)
{
if(x<0)putchar('-'),x=-x;
register short a[20]={},sz=0;
while(x>0)a[sz++]=x%10,x/=10;
if(sz==0)putchar('0');
for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline void putsp(){putchar(' ');}
inline void putendl(){putchar('\n');}
inline char mygetchar(){register char c=getchar();while(c==' '||c=='\n')c=getchar();return c;}
ll x,y;
int main()
{
cin>>x>>y;
for(int i=50;i>=1;i--)
{
ll nx=x+(1ll<<(i-1)),ny=y-(1ll<<i);
if(ny>=0)
{
if(nx<=ny/2)
{
x=nx;
y=ny;
}
}
}
cout<<min(x,y/2)<<endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Scc Puzzle |
User |
fizzydavid |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1461 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
256 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
00_example_01.txt, 00_example_02.txt |
All |
00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt |
Case Name |
Status |
Exec Time |
Memory |
00_example_01.txt |
AC |
1 ms |
256 KB |
00_example_02.txt |
AC |
1 ms |
256 KB |
01.txt |
AC |
1 ms |
256 KB |
02.txt |
AC |
1 ms |
256 KB |
03.txt |
AC |
1 ms |
256 KB |
04.txt |
AC |
1 ms |
256 KB |
05.txt |
AC |
1 ms |
256 KB |
06.txt |
AC |
1 ms |
256 KB |
07.txt |
AC |
1 ms |
256 KB |