Submission #1114954
Source Code Expand
#include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <string>
#include <sstream>
#include <time.h>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define lson l,m,rt*2
#define rson m+1,r,rt*2+1
#define mt(A,B) memset(A,B,sizeof(A))
using namespace std;
typedef long long LL;
const double PI = acos(-1);
const int N=2e5+10;
const LL mod=1e9+7;
const int inf = 0x3f3f3f3f;
const LL INF=0x3f3f3f3f3f3f3f3fLL;
int main()
{
#ifdef Local
freopen("data.txt","r",stdin);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
LL n,m,ans=0;
cin>>n>>m;
if(2*n>=m)
{
ans=m/2;
}
else
{
ans=n+(m-2*n)/4;
}
cout<<ans<<endl;
#ifdef Local
cerr << "time: " << (LL) clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
}
/*char s[40];
int ans=0;
int vis[4][4][4];
int dx[6]={1,-1,0,0,0,0};
int dy[6]={0,0,1,-1,0,0};
int dz[6]={0,0,0,0,1,-1};
bool check(int x,int y,int z)
{
if(x<1||x>3||y<1||y>3||z<1||z>3||vis[x][y][z])return false;
else return true;
}
void dfs(int cur,int x,int y,int z,int fx)
{
vis[x][y][z]=1;
if(cur==27)
{
ans++;
return;
}
if(s[cur]=='I')
{
int X,Y,Z;
X=x+dx[fx];
Y=y+dy[fx];
Z=z+dz[fx];
if(check(X,Y,Z))dfs(cur+1,X,Y,Z,fx);
}
else
{
for(int i=0;i<6;i++)
{
if(i==fx)continue;
int X,Y,Z;
X=x+dx[fx];
Y=y+dy[fx];
Z=z+dz[fx];
if(check(X,Y,Z))dfs(cur+1,X,Y,Z,i);
}
}
vis[x][y][z]=0;
}*/
/*mt(vis,0);
scanf("%s",s+1);
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
for(int k=1;k<=3;k++)
{
dfs(1,i,j,k,-1);
}
}
}
if(ans)puts("YES");
else puts("NO");*/
Submission Info
Submission Time |
|
Task |
C - Scc Puzzle |
User |
kcl886 |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
2127 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 |