結果
| 問題 |
No.3110 Like CPCTF?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-18 22:03:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 2,000 ms |
| コード長 | 1,564 bytes |
| コンパイル時間 | 3,578 ms |
| コンパイル使用メモリ | 227,984 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-18 22:03:48 |
| 合計ジャッジ時間 | 4,463 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
コンパイルメッセージ
main.cpp:9:12: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
9 | bool chmin(auto &a, auto b) { return a > b ? a = b, 1 : 0; }
| ^~~~
main.cpp:9:21: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
9 | bool chmin(auto &a, auto b) { return a > b ? a = b, 1 : 0; }
| ^~~~
main.cpp:10:12: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
10 | bool chmax(auto &a, auto b) { return a < b ? a = b, 1 : 0; }
| ^~~~
main.cpp:10:21: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
10 | bool chmax(auto &a, auto b) { return a < b ? a = b, 1 : 0; }
| ^~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
bool chmin(auto &a, auto b) { return a > b ? a = b, 1 : 0; }
bool chmax(auto &a, auto b) { return a < b ? a = b, 1 : 0; }
vector<ll> sin45 = {0, 1, 1, 1, 0, -1, -1, -1}, cos45 = {1, 1, 0, -1, -1, -1, 0, 1};
vector<ll> dx = {0, 1, 0, -1};
vector<ll> dy = {1, 0, -1, 0};
#define ft first
#define sd second
#define all(x) std::begin(x), std::end(x)
#define mp(a, b) make_pair(a, b)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb(x) push_back(x)
#define so(z) sort(z.begin(), z.end())
#define sor(z) sort(z.rbegin(), z.rend())
#define vec vector<ll>
#define vecc vector<vector<ll>>
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(20);
ll n;
string s;
cin >> n >> s;
if(n < 5) {
cout << 0 << endl;
return 0;
}
vector<int> mask(n, 0);
rep(i, 5) mask[i] = 1;
sort(mask.begin(), mask.end());
ll ans = 0;
do {
string t;
rep(i, n) {
if (mask[i] == 1) t += s[i];
}
bool flag = true;
set<char> st;
for (auto c : t) { st.insert(c); }
if (st.size() != 4) flag = false;
if (t[0] != t[2]) flag = false;
if (flag) ans++;
} while (next_permutation(mask.begin(), mask.end()));
cout << ans << endl;
}