結果
問題 | No.1159 Sashiming String |
ユーザー |
![]() |
提出日時 | 2021-09-10 01:35:22 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 525 bytes |
コンパイル時間 | 897 ms |
コンパイル使用メモリ | 137,088 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-01 18:35:30 |
合計ジャッジ時間 | 1,986 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 RE * 1 |
ソースコード
#include <algorithm>#include <iostream>#include <set>#include <vector>using namespace std;int main(void) {string s;cin >> s;vector<int> idxs;for (int i = 0; i < s.size()-2; ++i) {if (s.substr(i, 3) == "ing") idxs.push_back(i);}long long ans = 0;for (int i = 0; i < s.size(); ++i) {if (s[i] == 'S') {int idx = lower_bound(idxs.begin(), idxs.end(), i) - idxs.begin();ans += (idxs.size() - idx);}}cout << ans << endl;}