結果
問題 | No.2737 Compound Word |
ユーザー |
![]() |
提出日時 | 2024-04-26 22:24:26 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 661 bytes |
コンパイル時間 | 1,117 ms |
コンパイル使用メモリ | 126,336 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 14:07:39 |
合計ジャッジ時間 | 2,185 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
#include <iostream>#include <set>#include <vector>int count_possible_strings(int N, std::vector<std::string>& strings) {std::set<std::string> possible_strings;for (int i = 0; i < N; ++i) {for (int j = i + 1; j < N; ++j) {possible_strings.insert(strings[i] + strings[j]);possible_strings.insert(strings[j] + strings[i]);}}return possible_strings.size();}int main() {int N;std::cin >> N;std::vector<std::string> strings(N);for (int i = 0; i < N; ++i) {std::cin >> strings[i];}std::cout << count_possible_strings(N, strings) << std::endl;return 0;}