# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
223213 | errorgorn | Trener (COCI20_trener) | C++14 | 25 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ll,ii>
#define endl '\n'
const int MOD=1000000007;
int n,k;
map<string,ll> m[2];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>n>>k;
m[0][""]=1;
int a=0,b=1;
for (int x=0;x<n;x++){
for (int y=0;y<k;y++){
string s,t;
ll res=0;
cin>>s;
t=s;
t.pop_back();
if (m[a].count(t)) res+=m[a][t];
for (int x=1;x<s.size();x++){
if (t[x-1]!=s[x]){
t[x-1]=s[x];
if (m[a].count(t)) res+=m[a][t];
res%=MOD;
}
}
m[b][s]+=res;
m[b][s]%=MOD;
//cout<<s<<" "<<res<<endl;
}
swap(a,b);
m[b].clear();
}
ll ans=0;
for (auto &it:m[a]){
ans+=it.second;
}
cout<<ans%MOD<<endl;
}
컴파일 시 표준 에러 (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... |