結果

問題 No.3714 Prefix Team Name
コンテスト
ユーザー HoyHoyCharhang
提出日時 2026-09-18 21:25:00
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 324 ms / 2,000 ms
+ 966µs
コード長 1,087 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,042 ms
コンパイル使用メモリ 361,376 KB
実行使用メモリ 153,856 KB
最終ジャッジ日時 2026-09-18 21:25:24
合計ジャッジ時間 8,051 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,g,n) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define eb emplace_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<typename T> using pq = priority_queue<T,vector<T>,greater<T>>;
using P = pair<int,int>;
template<class T>bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,T b){if(b<a){a=b;return 1;}return 0;}

int main() {
  vector<string> s(3);
  rep(i,0,3) cin >> s[i];
  sort(all(s));
  set<string> st;
  do {
    string x = s[0], y = s[1], z = s[2];
    rep(i,1,len(x)+1) rep(j,1,len(y)+1) rep(k,1,len(z)+1) {
      st.emplace(x.substr(0, i)+y.substr(0, j)+z.substr(0, k));
    }
  } while(next_permutation(all(s)));
  // for (auto e : st) cout << e << endl;
  cout << len(st) << endl;
  return 0;
}
0