QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#745305#2920. Ultimate Binary WatchalexhamidiCompile Error//C++14691b2024-11-14 09:04:172024-11-14 09:04:18

Judging History

This is the latest submission verdict.

  • [2024-11-14 09:04:18]
  • Judged
  • [2024-11-14 09:04:17]
  • Submitted

answer

#include <iostream>

using namespace std;

int main() {


    string t;
    cin >> t;

    vector<vector<char>> ans(4, vector<char>(5, ' '));


    for (int i = 0; i < 4; i++) {
        int col = i + (i >= 2);
        int curr = t[i]-'0';
        for (int j = 3; j >= 0; j--) {
            if ((curr & 1) == 1) {
                ans[j][col] = '*';
            } else {
                ans[j][col] = '.';
            }
            curr >>= 1;
        }
    }

    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 5; j++) {
            cout << ans[i][j];
            if (j < 4) cout << " ";
        }
        cout << "\n";
    }


    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:11:5: error: ‘vector’ was not declared in this scope
   11 |     vector<vector<char>> ans(4, vector<char>(5, ' '));
      |     ^~~~~~
answer.code:2:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | 
answer.code:11:19: error: expected primary-expression before ‘char’
   11 |     vector<vector<char>> ans(4, vector<char>(5, ' '));
      |                   ^~~~
answer.code:19:17: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   19 |                 ans[j][col] = '*';
      |                 ^~~
      |                 abs
answer.code:21:17: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   21 |                 ans[j][col] = '.';
      |                 ^~~
      |                 abs
answer.code:29:21: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   29 |             cout << ans[i][j];
      |                     ^~~
      |                     abs