답안 #1011566

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1011566 2024-06-30T15:40:02 Z Pring Toilets (JOI16_toilets) C++17
36 / 100
2 ms 1116 KB
#include <bits/stdc++.h>
using namespace std;

#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif

#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;
typedef pair<int, int> pii;

int n, m;
string s, k;

void miku() {
    cin >> n >> m;
    assert(m == 1);
    cin >> s >> k;
    reverse(s.begin(), s.end());
    int now = 1, ans = 1;
    for (auto &i : s) {
        if (i == 'F') now++;
        else {
            now--;
            ans = min(ans, now);
        }
    }
    if (now < 0) cout << -1 << '\n';
    else cout << max(0, -ans) << '\n';
}

int32_t main() {
    cin.tie(0) -> sync_with_stdio(false);
    cin.exceptions(cin.failbit);
    miku();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 460 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 448 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 460 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 448 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 2 ms 856 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 1 ms 860 KB Output is correct
27 Correct 1 ms 860 KB Output is correct
28 Correct 2 ms 856 KB Output is correct
29 Correct 2 ms 856 KB Output is correct
30 Correct 2 ms 1012 KB Output is correct
31 Correct 1 ms 880 KB Output is correct
32 Correct 2 ms 860 KB Output is correct
33 Correct 2 ms 1116 KB Output is correct
34 Correct 1 ms 860 KB Output is correct
35 Correct 2 ms 860 KB Output is correct
36 Correct 2 ms 1016 KB Output is correct
37 Correct 1 ms 860 KB Output is correct
38 Correct 2 ms 860 KB Output is correct
39 Correct 2 ms 860 KB Output is correct
40 Correct 1 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 460 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 448 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 2 ms 856 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 1 ms 860 KB Output is correct
27 Correct 1 ms 860 KB Output is correct
28 Correct 2 ms 856 KB Output is correct
29 Correct 2 ms 856 KB Output is correct
30 Correct 2 ms 1012 KB Output is correct
31 Correct 1 ms 880 KB Output is correct
32 Correct 2 ms 860 KB Output is correct
33 Correct 2 ms 1116 KB Output is correct
34 Correct 1 ms 860 KB Output is correct
35 Correct 2 ms 860 KB Output is correct
36 Correct 2 ms 1016 KB Output is correct
37 Correct 1 ms 860 KB Output is correct
38 Correct 2 ms 860 KB Output is correct
39 Correct 2 ms 860 KB Output is correct
40 Correct 1 ms 860 KB Output is correct
41 Runtime error 2 ms 604 KB Execution killed with signal 6
42 Halted 0 ms 0 KB -