結果
| 問題 | No.3714 Prefix Team Name |
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2026-10-26 21:16:51 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 1,431 bytes |
| 記録 | |
| コンパイル時間 | 2,048 ms |
| コンパイル使用メモリ | 214,520 KB |
| 実行使用メモリ | 37,760 KB |
| 最終ジャッジ日時 | 2026-10-26 21:16:59 |
| 合計ジャッジ時間 | 7,306 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
using ll = long long;
struct point {
ll x, y;
};
bool is_upper(point &p) {
if(p.y > 0) return true;
if(p.y == 0 && p.x > 0) return true;
return false;
}
bool comp_ang(point &a, point &b) {
bool ua = is_upper(a);
bool ub = is_upper(b);
if(ua != ub) {
return ua > ub;
}
ll cross = a.x * b.y - a.y * b.x;
return cross > 0;
}
int main(){
vector<string> s(3);
cin >> s[0] >> s[1] >> s[2];
vector<set<string>> vst(3);
vector<int> sz(3);
rep(i, 0, 3) sz[i] = s[i].size();
rep(i, 0, 3) {
rep(j, 1, sz[i] + 1) {
vst[i].insert(s[i].substr(0, j));
}
}
using ST = vector<string>;
set<ST> st;
for(auto e1 : vst[0]) {
for(auto e2 : vst[1]) {
for(auto e3 : vst[2]) {
ST w;
w.push_back(e1);
w.push_back(e2);
w.push_back(e3);
sort(w.begin(), w.end());
st.insert(w);
}
}
}
ll ans = 0;
for(auto e: st) {
set<string> w;
vector<int> v(3);
rep(i, 0, 3) v[i] = i;
do {
string t;
rep(i, 0, 3) t += e[v[i]];
w.insert(t);
} while(next_permutation(v.begin(), v.end()));
ans += w.size();
}
cout << ans << endl;
}
forest3