Submission #1044106

# Submission time Handle Problem Language Result Execution time Memory
1044106 2024-08-05T07:25:46 Z CyberCow COVID tests (CEOI24_covid) C++17
Compilation error
0 ms 0 KB
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
using namespace std;

int N;
double P;

bool test_students(int g) {
    cout << "Q ";
    for ( i = 0; i < g; i++)
    {
        cout << 0;
    }
    cout << 1;
    for ( i = g + 1; i < N; i++)
    {
        cout << 0;
    }
    cout << endl;
    char c;
    cin >> c;
    if (c == 'P')
        return 1;
    return 0;
}

void find_positive(vector<bool> v) {
    cout << "A ";
    for ( i = 0; i < v.size(); i++)
    {
        cout << v[i] << ' ';
    }
    cout << endl;
    char c;
    cin >> c;
}

int main() {
    int T;
    cin >> N >> P >> T;
    for (int i = 0; i < T; i++) {
        vector<bool> answer;
        for ( j = 0; j < N; j++)
        {
            if (test_students(j))
            {
                answer.push_back(1);
            }
            else
            {
                answer.push_back(0);
            }
        }
    }
    return 0;
}

Compilation message

Main.cpp: In function 'bool test_students(int)':
Main.cpp:13:11: error: 'i' was not declared in this scope
   13 |     for ( i = 0; i < g; i++)
      |           ^
Main.cpp:18:11: error: 'i' was not declared in this scope
   18 |     for ( i = g + 1; i < N; i++)
      |           ^
Main.cpp: In function 'void find_positive(std::vector<bool>)':
Main.cpp:32:11: error: 'i' was not declared in this scope
   32 |     for ( i = 0; i < v.size(); i++)
      |           ^
Main.cpp: In function 'int main()':
Main.cpp:46:15: error: 'j' was not declared in this scope
   46 |         for ( j = 0; j < N; j++)
      |               ^