Submission #68391

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
683912018-08-17 04:17:10nvmdavaAliens (IOI07_aliens)C++17
100 / 100
5 ms556 KiB
#include <bits/stdc++.h>
using namespace std;
long long n;
char s[10];
bool ask(int x, int y){
if(x > n || x < 1 || y > n || y < 1){
return 0;
}
printf("examine %d %d\n", x, y);
fflush(stdout);
scanf("%s", &s);
return (s[0] == 't');
}
long long x, y, m;
int main(){
scanf("%d %d %d",&n,&x,&y);
long long left, right, up, down;
long long l = 0, r = x;
while(l + 1 != r){
int m = (l + r) / 2;
if(ask(m, y)){
r = m;
} else {
l = m;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

aliens.cpp: In function 'bool ask(int, int)':
aliens.cpp:13:16: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[10]' [-Wformat=]
  scanf("%s", &s);
              ~~^
aliens.cpp: In function 'int main()':
aliens.cpp:20:27: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
  scanf("%d %d %d",&n,&x,&y);
                   ~~      ^
aliens.cpp:20:27: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
aliens.cpp:20:27: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'long long int*' [-Wformat=]
aliens.cpp:98:49: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
  printf("solution %d %d\n", x + 2 * m, y + 2 * m);
                             ~~~~~~~~~           ^
aliens.cpp:98:49: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long long int' [-Wformat=]
aliens.cpp: In function 'bool ask(int, int)':
aliens.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", &s);
  ~~~~~^~~~~~~~~~
aliens.cpp: In function 'int main()':
aliens.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d",&n,&x,&y);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...