結果
| 問題 | No.3714 Prefix Team Name |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2026-09-19 12:45:22 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 356 ms / 2,000 ms |
| + 501µs | |
| コード長 | 1,209 bytes |
| 記録 | |
| コンパイル時間 | 955 ms |
| コンパイル使用メモリ | 96,024 KB |
| 実行使用メモリ | 95,560 KB |
| 最終ジャッジ日時 | 2026-09-19 12:45:39 |
| 合計ジャッジ時間 | 7,881 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3714.cc: No.3714 Prefix Team Name - yukicoder
*/
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 50;
/* typedef */
using vs = vector<string>;
/* global variables */
string ss[3];
int ls[3];
vs svs[MAX_N * 3 + 1];
/* subroutines */
/* main */
int main() {
for (int i = 0; i < 3; i++) {
char s[MAX_N + 4];
scanf("%s", s);
ss[i] = string(s);
ls[i] = (int)ss[i].size();
}
for (int l0 = 1; l0 <= ls[0]; l0++)
for (int l1 = 1; l1 <= ls[1]; l1++)
for (int l2 = 1; l2 <= ls[2]; l2++) {
string ts[3] = {
ss[0].substr(0, l0), ss[1].substr(0, l1), ss[2].substr(0, l2)
};
int ps[3] = {0, 1, 2};
do {
string w;
for (int i = 0; i < 3; i++) w += ts[ps[i]];
svs[l0 + l1 + l2].push_back(w);
} while (next_permutation(ps, ps + 3));
}
int l = ls[0] + ls[1] + ls[2];
int sum = 0;
for (int i = 1; i <= l; i++) {
auto &sv = svs[i];
sort(sv.begin(), sv.end());
sv.erase(unique(sv.begin(), sv.end()), sv.end());
sum += (int)sv.size();
//printf(" i=%d: sz=%d\n", i, (int)sv.size());
}
printf("%d\n", sum);
return 0;
}
tnakao0123