# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
223292 | dantoh000 | Trener (COCI20_trener) | C++14 | 18 ms | 3200 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
int n,k;
unordered_map<string,int> ct[2];
string a[55][1505];
int main(){
scanf("%d%d",&n,&k);
for (int i = 1; i <= n; i++){
for (int j = 1; j <= k; j++){
cin >> a[i][j];
}
}
ll ans = 0;
ct[0][""]++;
for (int i = 1; i <= n; i++){
assert(ct[i&1].size() == 0);
for (int j = 1; j <= k; j++){
string X = a[i][j].substr(1);
string Y = a[i][j].substr(0,a[i][j].size()-1);
//cout << a[i][j] << " " << X << " " << Y;
int res = ct[1-i&1][X];
if (X != Y) res += ct[1-i&1][Y];
//printf("%d %d\n",ct[X],ct[Y]);
ct[i&1][a[i][j]] += res;
ct[i&1][a[i][j]] %= mod;
if (i == n) ans += res;
}
ct[1-i&1].clear();
}
printf("%lld",ans%mod);
}
컴파일 시 표준 에러 (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... |