# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
52141 | ainta | 스탬프 수집 (JOI16_ho_t2) | C++17 | 5 ms | 3488 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<cstdio>
#include<algorithm>
using namespace std;
int C[101000][3];
int n;
char p[101000];
long long s = 0, res, s2 = 0, M;
int main() {
int i, j;
scanf("%d", &n);
scanf("%s", p + 1);
for (i = 1; i <= n; i++) {
for (j = 0; j < 3; j++)C[i][j] = C[i - 1][j];
if (p[i] == 'J')C[i][0]++;
if (p[i] == 'O') {
s += C[i][0];
C[i][1]++;
}
if (p[i] == 'I') {
C[i][2]++;
res += s;
}
}
int c = 0;
for (i = n; i >= 1; i--) {
if (p[i] == 'I')c++;
if (p[i] == 'O')s2 += c;
}
M = max(s2, s);
for (i = 0; i <= n; i++) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |