Submission #994024

# Submission time Handle Problem Language Result Execution time Memory
994024 2024-06-07T03:15:25 Z vjudge1 Kartomat (COCI17_kartomat) C++17
80 / 80
1 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    string a[n];
    for (int i = 0; i < n; i ++)
        cin >> a[i];
    string s;
    cin >> s;

    vector<int> possible;
    for (int i = 0; i < n; i ++){
        if (a[i].size() <= s.size()) continue;
        bool bad = 0;
        for (int j = 0; j < s.size(); j ++){
            if (a[i][j] != s[j]){
                bad = 1;
            }
        }

        if (bad) continue;
        possible.push_back(a[i][s.size()] - 'A' + 3);
    }

    char mat[4][8];
    for (int i = 0; i < 4; i ++)
        for (int j = 0; j < 8; j ++)
            mat[i][j] = '*';
    
    for (int x : possible){
        char ch = char(x - 3 + 'A');
        int r = x / 8;
        int c = x % 8;

        mat[r][c] = ch;
    }

    for (int i = 0; i < 4; i ++){
        for (int j = 0; j < 8; j ++)
            cout << mat[i][j];
        cout << endl;
    }
}

Compilation message

kartomat.cpp: In function 'int main()':
kartomat.cpp:17:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for (int j = 0; j < s.size(); j ++){
      |                         ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct