제출 #1356511

#제출 시각아이디문제언어결과실행 시간메모리
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;
}

컴파일 시 표준 에러 (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);
      |         ~~~~~^~~~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…