提出 #43668683
ソースコード 拡げる
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REPI,_REP,)(__VA_ARGS__)
#define _RREP(i,n) RREPI(i,n,0)
#define RREPI(i,a,b) for(int i=int(a);i>=int(b);--i)
#define RREP(...) _overload3(__VA_ARGS__,RREPI,_RREP,)(__VA_ARGS__)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
typedef long long ll;
const int INF32 = 1001001001;
const long long INF64 = 1001001001001001001;
struct Init { Init() { ios::sync_with_stdio(0); cin.tie(0); cout << setprecision(15); }} init;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template<class T> T gcd(T x, T y){ return (x % y) ? gcd(y, x % y) : y; }
template<class T> T lcm(T x, T y){ return x / gcd(x, y) * y; }
template<class T, class... Ts> void output(const T& a, const Ts&... b) { cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; }
template<class T> void output(vector<T> v) { for (auto u : v) cout << u << ' '; cout << '\n'; };
void yesno(bool is_ok) { cout << (is_ok ? "yes" : "no") << '\n'; }
void YesNo(bool is_ok) { cout << (is_ok ? "Yes" : "No") << '\n'; }
void YESNO(bool is_ok) { cout << (is_ok ? "YES" : "NO") << '\n'; }
// clang-format on
using mint = modint;
int main() {
int n;
cin >> n;
string s;
cin >> s;
mint::set_mod(10007);
vector dp(n + 1, vector<mint>(1 << 3, 0));
dp[0][1] = 1;
unordered_map<char, int> mp;
mp['J'] = 0;
mp['O'] = 1;
mp['I'] = 2;
REP(i, n) {
REP(prev, 1 << 3) {
REP(next, 1 << 3) {
if (!(prev & next)) continue;
if (!(next & (1 << mp[s[i]]))) continue;
dp[i + 1][next] += dp[i][prev];
}
}
}
mint ans = 0;
REP(i, 1 << 3) { ans += dp[n][i]; }
output(ans.val());
}
提出情報
コンパイルエラー
./Main.cpp: In instantiation of ‘void output(const T&, const Ts& ...) [with T = unsigned int; Ts = {}]’:
./Main.cpp:58:21: required from here
./Main.cpp:26:86: warning: statement has no effect [-Wunused-value]
26 | template<class T, class... Ts> void output(const T& a, const Ts&... b) { cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; }
| ^~~~
ジャッジ結果
| セット名 |
set01 |
set02 |
set03 |
set04 |
set05 |
| 得点 / 配点 |
20 / 20 |
20 / 20 |
20 / 20 |
20 / 20 |
20 / 20 |
| 結果 |
|
|
|
|
|
| セット名 |
テストケース |
| set01 |
data1 |
| set02 |
data2 |
| set03 |
data3 |
| set04 |
data4 |
| set05 |
data5 |
| ケース名 |
結果 |
実行時間 |
メモリ |
| data1 |
AC |
6 ms |
3636 KiB |
| data2 |
AC |
2 ms |
3584 KiB |
| data3 |
AC |
3 ms |
3632 KiB |
| data4 |
AC |
3 ms |
3712 KiB |
| data5 |
AC |
4 ms |
3604 KiB |