# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
223204 | tqbfjotld | Trener (COCI20_trener) | C++14 | 261 ms | 16068 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
unordered_map<string,int> ways;
int main(){
int n,k;
cin>>n;
cin>>k;
for (int x = 0; x<n; x++){
for (int y = 0; y<k; y++){
string str;
cin>>str;
if (str.size()==1){
ways[str]++;
}
else{
string str1 = "";
string str2 = "";
for (int i = 0; i<str.size(); i++){
if (i!=0){
str2 += str[i];
}
if (i!=str.size()-1){
str1+=str[i];
}
}
if (str1!=str2){
ways[str] += ways[str1];
ways[str] %= MOD;
ways[str] += ways[str2];
ways[str] %= MOD;
}
else{
ways[str] += ways[str1];
ways[str] %=MOD;
}
}
}
}
int ans = 0;
for (auto x : ways){
if (x.first.size()==n){
ans += x.second;
ans %= MOD;
}
}
printf("%d",ans);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |