結果
問題 |
No.118 門松列(2)
|
ユーザー |
|
提出日時 | 2016-03-05 21:01:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 701 bytes |
コンパイル時間 | 728 ms |
コンパイル使用メモリ | 72,176 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-24 14:29:10 |
合計ジャッジ時間 | 1,710 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 22 |
ソースコード
#include <iostream> #include <string> #include <unordered_map> #include <limits> using namespace std; int main() { int n; cin >> n; unordered_map<string, int> map; string len; for (int i = 0; i < n; i++) { cin >> len; map[len]++; } const int r = 3; long long divided = 1; int divisor = 1; int not_overlap_count = map.size(); for (int i = 0; i < r; i++) { divided *= not_overlap_count - i; divisor *= r - i; } long long pattern = divided / divisor; for (auto keyValue : map) { pattern *= keyValue.second; } long long res; if (numeric_limits<int>::max() < pattern) { res = pattern % (1000000000 + 7); } else { res = pattern; } cout << res << endl; return 0; }