Submission #1114838
Source Code Expand
#include <cstdio>
#include <iostream>
typedef long long i64;
#define MID ((l+r)>>1)
i64 N, M;
void exec() {
i64 l(-1), r(1e12+1);
scanf("%lld%lld", &N, &M);
while (l+1 < r) {
(std::min(N + std::max((M-MID*2) / 2, 0ll), M/2) >= MID? l : r) = MID;
}
printf("%lld\n", l);
}
int main() {
if (fopen("C.in", "r") != NULL) {
freopen("C.in", "r", stdin);
freopen("C.out", "w", stdout);
}
exec();
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Scc Puzzle |
User |
fuboat |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
461 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
256 KB |
Compile Error
./Main.cpp: In function ‘void exec()’:
./Main.cpp:12:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld%lld", &N, &M);
^
./Main.cpp: In function ‘int main()’:
./Main.cpp:21:32: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen("C.in", "r", stdin);
^
./Main.cpp:22:34: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen("C.out", "w", stdout);
^
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 |