Skip to content

Commit 774a57e

Browse files
committed
atcoder/abc055C
1 parent aad99b4 commit 774a57e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

atcoder/abc055/C/main.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = long long;
5+
6+
ll solve(ll N, ll M) {
7+
if (N >= M / 2) {
8+
return M / 2;
9+
}
10+
return N + (M - 2 * N) / 4;
11+
}
12+
13+
int main() {
14+
ios_base::sync_with_stdio(false);
15+
cin.tie(0); cout.tie(0);
16+
17+
ll N, M;
18+
cin >> N >> M;
19+
cout << solve(N, M) << endl;
20+
21+
return 0;
22+
}

0 commit comments

Comments
 (0)