답안 #182403

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
182403 2020-01-09T17:29:39 Z XmtosX Kartomat (COCI17_kartomat) C++17
72 / 80
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
string ans="***ABCDEFGHIJKLMNOPQRSTUVWXYZ***",a;
vector <string> s;
int n;
void fin()
{
    for (int i=0;i<4;i++)
    {
        for (int j=0;j<8;j++)
            cout <<ans[j+i*8];
        cout <<endl;
    }
}
int main()
{
    cin >>n;
    for (int i=0;i<n;i++)
    {
        cin >>a;
        s.push_back(a);
    }
    cin >>a;
    for (int j=0;j<=a.size();j++)
    {
        int cnt[300]={0};
        for (int i=0;i<s.size();i++)
        {
            cnt[s[i][j]]++;
        }
        for (int i='A';i<='Z';i++)
        {
            if (!cnt[i])
                ans[i-'A'+3]='*';
            else
                ans[i-'A'+3]=i;
        }
        if (j)
            for (int i=0;i<s.size();i++)
            {
                if (s[i].size()<j||s[i].substr(0,j)!=a.substr(0,j))
                {
                    s.erase(s.begin()+i);
                    i--;
                }
            }
    }
    fin();
    return 0;
}

Compilation message

kartomat.cpp: In function 'int main()':
kartomat.cpp:24:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int j=0;j<=a.size();j++)
                  ~^~~~~~~~~~
kartomat.cpp:27:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i=0;i<s.size();i++)
                      ~^~~~~~~~~
kartomat.cpp:29:24: warning: array subscript has type 'char' [-Wchar-subscripts]
             cnt[s[i][j]]++;
                        ^
kartomat.cpp:39:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i=0;i<s.size();i++)
                          ~^~~~~~~~~
kartomat.cpp:41:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (s[i].size()<j||s[i].substr(0,j)!=a.substr(0,j))
                     ~~~~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct