Submission #1356511

#TimeUsernameProblemLanguageResultExecution timeMemory
1356511nguyenkhangninh99Worm Worries (BOI18_worm)C++20
10 / 100
0 ms404 KiB
#include <stdio.h>

int main(){
    int n, m, k, q;
    scanf("%d %d %d %d", &n, &m, &k, &q);
    int l = 1, r = n;
    while(l < r){
        int mid = (l + r) / 2;
        int v1, v2;
        printf("? %d 1 1\n", mid);
        fflush(stdout);
        scanf("%d", &v1);
        printf("? %d 1 1\n", mid + 1);
        fflush(stdout);
        scanf("%d", &v2);
        int right = (v1 < v2);
        l = right ? mid + 1 : l;
        r = right ? r : mid;
    }
    printf("! %d 1 1\n", l);
    fflush(stdout);
    return 0;
}

Compilation message (stderr)

worm.cpp: In function 'int main()':
worm.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     scanf("%d %d %d %d", &n, &m, &k, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
worm.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d", &v1);
      |         ~~~~~^~~~~~~~~~~
worm.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%d", &v2);
      |         ~~~~~^~~~~~~~~~~
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...