# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
55412 | 2018-07-07T08:26:47 Z | 강태규(#1543) | Toilets (JOI16_toilets) | C++11 | 4 ms | 876 KB |
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <deque> #include <set> #include <map> #include <unordered_map> #include <functional> #include <cstring> #include <cmath> #include <ctime> #include <cstdlib> using namespace std; typedef long long llong; typedef long double ld; typedef pair<int, int> pii; typedef pair<llong, llong> pll; int n, m; char str[100001]; int main() { scanf("%d%d", &n, &m); scanf("%s%d", str); int mn = 0, sum = 0; for (int i = strlen(str); i--; ) { sum += (str[i] == 'M' ? -1 : 1); mn = min(mn, sum); } if (sum < 0) printf("-1\n"); else if (mn > -2) printf("0\n"); else printf("%d\n", -(mn + 1)); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 488 KB | Output is correct |
5 | Correct | 2 ms | 496 KB | Output is correct |
6 | Correct | 2 ms | 520 KB | Output is correct |
7 | Correct | 2 ms | 580 KB | Output is correct |
8 | Correct | 2 ms | 580 KB | Output is correct |
9 | Correct | 2 ms | 580 KB | Output is correct |
10 | Correct | 2 ms | 580 KB | Output is correct |
11 | Correct | 2 ms | 580 KB | Output is correct |
12 | Correct | 2 ms | 580 KB | Output is correct |
13 | Correct | 2 ms | 580 KB | Output is correct |
14 | Correct | 2 ms | 580 KB | Output is correct |
15 | Correct | 2 ms | 580 KB | Output is correct |
16 | Correct | 2 ms | 580 KB | Output is correct |
17 | Correct | 2 ms | 580 KB | Output is correct |
18 | Correct | 2 ms | 580 KB | Output is correct |
19 | Correct | 2 ms | 580 KB | Output is correct |
20 | Correct | 3 ms | 580 KB | Output is correct |
21 | Correct | 2 ms | 580 KB | Output is correct |
22 | Correct | 3 ms | 580 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 488 KB | Output is correct |
5 | Correct | 2 ms | 496 KB | Output is correct |
6 | Correct | 2 ms | 520 KB | Output is correct |
7 | Correct | 2 ms | 580 KB | Output is correct |
8 | Correct | 2 ms | 580 KB | Output is correct |
9 | Correct | 2 ms | 580 KB | Output is correct |
10 | Correct | 2 ms | 580 KB | Output is correct |
11 | Correct | 2 ms | 580 KB | Output is correct |
12 | Correct | 2 ms | 580 KB | Output is correct |
13 | Correct | 2 ms | 580 KB | Output is correct |
14 | Correct | 2 ms | 580 KB | Output is correct |
15 | Correct | 2 ms | 580 KB | Output is correct |
16 | Correct | 2 ms | 580 KB | Output is correct |
17 | Correct | 2 ms | 580 KB | Output is correct |
18 | Correct | 2 ms | 580 KB | Output is correct |
19 | Correct | 2 ms | 580 KB | Output is correct |
20 | Correct | 3 ms | 580 KB | Output is correct |
21 | Correct | 2 ms | 580 KB | Output is correct |
22 | Correct | 3 ms | 580 KB | Output is correct |
23 | Runtime error | 3 ms | 876 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
24 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 488 KB | Output is correct |
5 | Correct | 2 ms | 496 KB | Output is correct |
6 | Correct | 2 ms | 520 KB | Output is correct |
7 | Correct | 2 ms | 580 KB | Output is correct |
8 | Correct | 2 ms | 580 KB | Output is correct |
9 | Correct | 2 ms | 580 KB | Output is correct |
10 | Correct | 2 ms | 580 KB | Output is correct |
11 | Correct | 2 ms | 580 KB | Output is correct |
12 | Correct | 2 ms | 580 KB | Output is correct |
13 | Correct | 2 ms | 580 KB | Output is correct |
14 | Correct | 2 ms | 580 KB | Output is correct |
15 | Correct | 2 ms | 580 KB | Output is correct |
16 | Correct | 2 ms | 580 KB | Output is correct |
17 | Correct | 2 ms | 580 KB | Output is correct |
18 | Correct | 2 ms | 580 KB | Output is correct |
19 | Correct | 2 ms | 580 KB | Output is correct |
20 | Correct | 3 ms | 580 KB | Output is correct |
21 | Correct | 2 ms | 580 KB | Output is correct |
22 | Correct | 3 ms | 580 KB | Output is correct |
23 | Runtime error | 3 ms | 876 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
24 | Halted | 0 ms | 0 KB | - |