Task: | HIIT remains |
Sender: | hefapa_aachen |
Submission time: | 2024-09-28 15:05:08 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | WRONG ANSWER | 0.04 s | details |
#4 | WRONG ANSWER | 0.01 s | details |
Code
// ~/.vim/cpp_template.cpp #include <bits/stdc++.h> #include <iostream> #include <vector> #include <algorithm> #include <string> #define REP(i,a,b) for (int i = a; i < b; i++) // Type Aliases for 1D and 2D vectors with initialization #define vi(n, val) vector<int>(n, val) // 1D vector of ints with size n, initialized to val #define vll(n, val) vector<long long>(n, val) // 1D vector of long longs with size n, initialized to val #define ll long long #define vvi(n, m, val) vector<vector<int>>(n, vector<int>(m, val)) // 2D vector of ints (n x m), initialized to val #define vvll(n, m, val) vector<vector<long long>>(n, vector<long long>(m, val)) // 2D vector of long longs (n x m), initialized to val using namespace std; template <typename T> void pV(const std::vector<T>& vec, const std::string& label = "Vector") { std::cout << label << ": [ "; for (const auto& elem : vec) { std::cout << elem << " "; } std::cout << "]" << std::endl; } using namespace std; void dfs(int s, vector<bool> *visited, vector<int> (*adj)[]) { if ((*visited)[s]) return; (*visited)[s] = true; // process node s for (auto u: (*adj)[s]) { dfs(u, visited, adj); } } /* vector<int> adj[N]; vector<bool> visited(N, false); int u, v; for(int i = 0; i < M;i++){ cin >> u >> v; u--; v--; adj[u].push_back(v); adj[v].push_back(u); } */ int main() { ios::sync_with_stdio(0); cin.tie(0); // Your code starts here int t; cin >> t; REP(i, 0, t){ string s; cin >> s; int n; n = s.size(); vector<int> H(n, 0), HI(n, 0), HII(n, 0), HIIT(n, 0); REP(i, 0, n){ if(i > 0){ H[i] = H[i-1]; } if(s[i] == 'H'){ H[i]++; } } REP(i, 1, n){ if(s[i] == 'I'){ HI[i] = H[i-1] + HI[i-1]; }else{ HI[i] = HI[i-1]; } } REP(i, 1, n){ if(s[i] == 'I'){ HII[i] = HI[i-1] + HII[i-1]; }else{ HII[i] = HII[i-1]; } } REP(i, 1, n){ if(s[i] == 'T'){ HIIT[i] = HII[i-1] + HIIT[i-1]; }else{ HIIT[i] = HIIT[i-1]; } } cout << HIIT[n-1] << endl; } return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
100 IIITIIIHITHTHIIITIII HIHIIIIIIHIIITHIIIII ITTIIIITIIIIIIITIIIT IITHITITIHHIITTTIIII ... |
correct output |
---|
12 84 0 37 96 ... |
user output |
---|
12 84 0 37 96 ... Truncated |
Test 2
Verdict: ACCEPTED
input |
---|
100 TIIHHITTITITIHTHIIIITHIHHIIHTI... |
correct output |
---|
606723862 621369559 655243897 550750615 717769300 ... |
user output |
---|
606723862 621369559 655243897 550750615 717769300 ... Truncated |
Test 3
Verdict: WRONG ANSWER
input |
---|
10 TTHTHHTIIIIIITHIIHIITITTITTIIH... |
correct output |
---|
64668032062669502 66159978956790306 65755072918424640 64408596558953628 65238005187079543 ... |
user output |
---|
-2023013698 2081495586 -210006976 -27214692 -1123553929 ... Truncated |
Test 4
Verdict: WRONG ANSWER
input |
---|
3 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH... |
correct output |
---|
781234375000000000 4999750003 0 |
user output |
---|
1613956608 704782707 0 |