Submission #91672

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
916722018-12-29 06:16:08ics0503Aliens (IOI07_aliens)C++17
100 / 100
3 ms380 KiB
#include<stdio.h>
#include<string.h>
long long min(long long a, long long b) { if (a < b)return a; return b; }
bool qr(long long x, long long y) {
printf("examine %lld %lld\n", x, y);
fflush(stdout);
char X[10]; scanf("%s", X);
if (strcmp(X, "true") == 0)return 1; return 0;
}
void sol(long long x, long long y) {
printf("solution %lld %lld\n", x, y);
fflush(stdout);
}
int main() {
long long n, x0, y0; scanf("%lld%lld%lld", &n, &x0, &y0);
long long sx, sy, ex, ey, i, j, bef;
bef = x0;
for (i = 0;; i++) {
long long x = x0 + (1ll << i);
if (x > n)x = n;
if (x == n || qr(x, y0) == 0) {
long long s = bef, e = x;
while (s <= e) {
long long m = (s + e) / 2;
if (qr(m, y0))s = m + 1, ex = m;
else e = m - 1;
}
break;
}
bef = x;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

aliens.cpp: In function 'bool qr(long long int, long long int)':
aliens.cpp:8:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
  if (strcmp(X, "true") == 0)return 1; return 0;
  ^~
aliens.cpp:8:39: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  if (strcmp(X, "true") == 0)return 1; return 0;
                                       ^~~~~~
aliens.cpp: In function 'int main()':
aliens.cpp:16:31: warning: unused variable 'j' [-Wunused-variable]
  long long sx, sy, ex, ey, i, j, bef;
                               ^
aliens.cpp: In function 'bool qr(long long int, long long int)':
aliens.cpp:7:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  char X[10]; scanf("%s", X);
              ~~~~~^~~~~~~~~
aliens.cpp: In function 'int main()':
aliens.cpp:15:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  long long n, x0, y0; scanf("%lld%lld%lld", &n, &x0, &y0);
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aliens.cpp:16:16: warning: 'sy' may be used uninitialized in this function [-Wmaybe-uninitialized]
  long long sx, sy, ex, ey, i, j, bef;
                ^~
aliens.cpp:77:20: warning: 'sx' may be used uninitialized in this function [-Wmaybe-uninitialized]
  long long m = (ex - sx + 1);
                 ~~~^~~~
aliens.cpp:77:20: warning: 'ex' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...