답안 #1011564

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1011564 2024-06-30T15:38:04 Z Pring Toilets (JOI16_toilets) C++17
0 / 100
1 ms 348 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;
    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 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -