Submission #75460792


Source Code Expand

//競プロ C++テンプレ
#include <bits/stdc++.h>
using namespace std;

#define all(x) x.begin(),x.end()
#define ll long long
#define pb push_back

const int MOD = 998244353;

ll ruiseki(int x){
  ll ans = 0;
  for(int i = 1; i <= x;i++){
    ans += i;
  }
  return ans % MOD;
}

int main() {
    string kk;
    cin >> kk;
    int llon = kk.size();
    int ss = 1;
    bool iso = false;
    vector<ll> vec;
    for(int i = 0; i < llon-1;i++){
      if(kk.at(i) != kk.at(i+1)){
        ss++;
        iso = true;
      }else{
        vec.push_back(ss);
        ss = 1;
        iso = false;
        if(i == llon - 2) vec.push_back(1);
      }
    }
    //if(ss == )
    if(iso) vec.push_back(ss);
    ll ans = 0;
    
    for(int i = 0;i < int(vec.size());i++){
      ll aa = vec.at(i);
      ll bb = ruiseki(aa);
      ans += bb;
    }
    
    cout << ans % MOD;
}


Submission Info

Submission Time
Task C - Not Adjacent
User gumi11ta
Language C++23 (GCC 15.2.0)
Score 0
Code Size 921 Byte
Status WA
Exec Time 9 ms
Memory 8092 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 27
WA × 1
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
min.txt WA 1 ms 3448 KiB
random_01.txt AC 5 ms 3900 KiB
random_02.txt AC 4 ms 3724 KiB
random_03.txt AC 5 ms 3776 KiB
random_04.txt AC 3 ms 3640 KiB
random_05.txt AC 5 ms 3900 KiB
random_06.txt AC 3 ms 3764 KiB
random_07.txt AC 6 ms 4076 KiB
random_08.txt AC 3 ms 3652 KiB
random_09.txt AC 6 ms 3980 KiB
random_10.txt AC 7 ms 4636 KiB
random_11.txt AC 8 ms 4776 KiB
random_12.txt AC 2 ms 3528 KiB
random_13.txt AC 9 ms 5916 KiB
random_14.txt AC 6 ms 4732 KiB
random_15.txt AC 9 ms 5956 KiB
random_16.txt AC 4 ms 4652 KiB
random_17.txt AC 8 ms 5848 KiB
random_18.txt AC 6 ms 5696 KiB
random_19.txt AC 9 ms 7896 KiB
random_20.txt AC 3 ms 4028 KiB
random_21.txt AC 9 ms 7972 KiB
random_22.txt AC 5 ms 5744 KiB
random_23.txt AC 8 ms 8092 KiB
random_24.txt AC 2 ms 3956 KiB
random_25.txt AC 8 ms 7956 KiB
sample_01.txt AC 1 ms 3432 KiB
sample_02.txt AC 1 ms 3424 KiB