제출 #1332869

#제출 시각아이디문제언어결과실행 시간메모리
1332869duskyDark Ride (EGOI25_darkride)C++20
0 / 100
1 ms412 KiB
#include <bits/stdc++.h>
using namespace std;

int n;

int find(vector<int> space) {
    if (space.size() == 1) return space[0];

    vector<bool> inq(n, 0); int mid = ((space.size()-1)/2);
    for (int i = 0; i <= mid; i++) inq[space[i]] = true;
    printf("? "); for (int i = 0; i < n; i++) printf("%d", inq[i] == true); printf("\n");

    int x; scanf("%d", &x);
    vector<int> nextq;
    if (x%2) for (int i = 0; i <= mid; i++) nextq.push_back(space[i]);
    else for (int i = mid+1; i < space.size(); i++) nextq.push_back(space[i]);
    return find(nextq);
}

int main() {
    // freopen("in.txt", "r", stdin);

    scanf("%d", &n);
    for (int i = 0; i <= 10; i++) {
        printf("? ");
        for (int j = 0; j < n; j++) printf("%d", (bool)(j & (1 << i)));
        printf("\n");

        int x; scanf("%d", &x);
        if (x%2) {
            vector<int> lh, rh;
            for (int j = 0; j < n; j++) {
                if (j & (1 << i)) lh.push_back(j);
                else rh.push_back(j);
            } printf("! %d %d\n", find(lh), find(rh));
            return 0;
        }
    }
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int find(std::vector<int>)':
Main.cpp:13:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     int x; scanf("%d", &x);
      |            ~~~~~^~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
Main.cpp:29:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |         int x; scanf("%d", &x);
      |                ~~~~~^~~~~~~~~~
#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...