# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1133544 | nuutsnoynton | 스탬프 수집 (JOI16_ho_t2) | C++20 | 5 ms | 2888 KiB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll J[100005], O[100002], I[100002];
int main() {
ll n, m, r, x, y, i,p, j,cnt1,cnt, ans, t,s, mx, mn, k;
string str;
cin >> n >> str;
for (i = 0; i < n; i ++) {
J[i + 1] = J[i];
O[i + 1] = O[i];
I[i + 1] = I[i];
if ( str[i] == 'J') J[i + 1] ++;
if ( str[i] == 'O') O[i + 1] ++;
if ( str[i] == 'I') I[i + 1] ++;
}
ans= 0;
for (i = 1; i <= n; i ++) {
if ( str[i - 1] == 'O') {
ans = ans + (J[i] * (I[n] - I[i ]));
}
}
// J
cnt = 0;
cnt1 = 0;
for (i = n; i >= 1; i --) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |