답안 #238563

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
238563 2020-06-11T21:41:19 Z vankata Trener (COCI20_trener) C++14
0 / 110
18 ms 1408 KB
#include<bits/stdc++.h>
using namespace std;

const int MAXN = 2048;
const int MOD = (int)(1e9+7);

map<string,int>mp;

long long n,k;

bool cmp(string a,string b)
{
    for(size_t i=0;i<a.size();i++)
    {
        if(a[i]!=b[i])return false;
    }return true;
}

void read()
{
    int i,j,l;
    long long ans = 0;
    cin>>n>>k;
    string s,t,q;
    int lm=0;
    for(i=0;i<n;i++)
    {
        for(j=0;j<k;j++)
        {
            cin>>s;

            if(!i){mp[s]++;continue;}

            t="";
            q="";
            for(l=0;l<s.size();l++)
            {
                if(l>0)q+=s[l];
                if(l!=s.size()-1)t+=s[l];
            }
            mp[s]+=mp[q];
            if(!cmp(q,t))mp[s]+=mp[t];
            mp[s]%=MOD;
            if(i==n-1)
            {
                ans+=mp[s];
                ans%=MOD;
            }
        }
    }
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    read();
    return 0;
}

Compilation message

trener.cpp: In function 'void read()':
trener.cpp:36:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(l=0;l<s.size();l++)
                     ~^~~~~~~~~
trener.cpp:39:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if(l!=s.size()-1)t+=s[l];
                    ~^~~~~~~~~~~~
trener.cpp:25:9: warning: unused variable 'lm' [-Wunused-variable]
     int lm=0;
         ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Incorrect 4 ms 384 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 1408 KB Output is correct
2 Correct 17 ms 1408 KB Output is correct
3 Correct 17 ms 1408 KB Output is correct
4 Incorrect 8 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Incorrect 4 ms 384 KB Output isn't correct