답안 #1068219

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068219 2024-08-21T08:39:53 Z vjudge1 COVID tests (CEOI24_covid) C++17
0 / 100
2319 ms 416 KB
#include <bits/stdc++.h>
#define int long long 
#define endl "\n"
using namespace std;
int N;
double P;
bool test_students(vector<bool> mask) {
    assert(mask.size() == (size_t)N);
    std::string mask_str(N, ' ');
    for (int i = 0; i < N; i++)
        mask_str[i] = mask[i] ? '1' : '0';
    printf("Q %s\n", mask_str.c_str());
    fflush(stdout);
    char answer;
    scanf(" %c", &answer);
    return answer == 'P';
}
vector<bool> find_positive() {
    vector<bool> answer(N);
    vector<bool> idk(N,false);
    for(int i=0;i<N;i++){
        idk[i]=true;
        answer[i]=test_students(idk);
        idk[i]=false;
    }
    return answer;
}
signed main() {
    int T;
    scanf("%d %lf %d", &N, &P, &T);
    for (int i = 0; i < T; i++) {
        vector<bool> answer = find_positive();
        assert(answer.size() == (size_t)N);
        string answer_str(N, ' ');
        for (int j = 0; j < N; j++){
            answer_str[j] = answer[j] ? '1' : '0';
        }
        printf("A %s\n", answer_str.c_str());
        fflush(stdout);
        char verdict;
        scanf(" %c", &verdict);
        if (verdict == 'W'){
            exit(0);
        }
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:30:13: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   30 |     scanf("%d %lf %d", &N, &P, &T);
      |            ~^          ~~
      |             |          |
      |             int*       long long int*
      |            %lld
Main.cpp:30:20: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'long long int*' [-Wformat=]
   30 |     scanf("%d %lf %d", &N, &P, &T);
      |                   ~^           ~~
      |                    |           |
      |                    int*        long long int*
      |                   %lld
Main.cpp: In function 'bool test_students(std::vector<bool>)':
Main.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf(" %c", &answer);
      |     ~~~~~^~~~~~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:30:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     scanf("%d %lf %d", &N, &P, &T);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:41:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |         scanf(" %c", &verdict);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2319 ms 416 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -