#include "bits/stdc++.h"
#include "grader.h"
using namespace std;
int Guess(int G);
int f(int l, int r) {
if (l == r) {
cout << l << "\n";
return l;
}
Guess(l);
int g2 = Guess(r);
if (r - l == 1) {
if (g2 == -1) {
cout << l << "\n";
return l;
}
else {
cout << r << "\n";
return r;
}
}
if (g2 == 0) {
cout << (l+r)/2 << "\n";
return (l+r)/2;
}
if (g2 == -1) {
if ((l + r) % 2 == 1)
return f(l, (l+r)/2);
else
return f(l, (l+r)/2-1);
}
else {
if ((l+r) % 2 == 1)
return f((l+r)/2+1, r);
else
return f((l+r)/2, r);
}
}
int HC(int N){
return f(1, N);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
1884 KB |
잘못된 접근입니다. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
1884 KB |
잘못된 접근입니다. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
1872 KB |
잘못된 접근입니다. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
506 ms |
32968 KB |
잘못된 접근입니다. |
2 |
Halted |
0 ms |
0 KB |
- |