답안 #696774

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
696774 2023-02-07T08:34:58 Z Cross_Ratio Toilets (JOI16_toilets) C++14
36 / 100
4 ms 3984 KB
#include <bits/stdc++.h>
using namespace std;
string s[100005];
int A[100005];
signed main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int N;
    int M;
    cin >> N >> M;
    int i, j;
    for(i=0;i<M;i++) cin >> s[i] >> A[i];
    int cnt = 0;
    int ma = 0;
    for(i=2*N-1;i>=0;i--) {
        if(s[0][i]=='M') cnt++;
        else cnt--;
        ma = max(ma, cnt);
    }
    cout << (cnt <= 0 ? max(0,ma-1) : -1);
}

Compilation message

toilets.cpp: In function 'int main()':
toilets.cpp:12:12: warning: unused variable 'j' [-Wunused-variable]
   12 |     int i, j;
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 2 ms 3452 KB Output is correct
3 Correct 3 ms 3412 KB Output is correct
4 Correct 2 ms 3452 KB Output is correct
5 Correct 2 ms 3456 KB Output is correct
6 Correct 2 ms 3412 KB Output is correct
7 Correct 2 ms 3456 KB Output is correct
8 Correct 2 ms 3456 KB Output is correct
9 Correct 2 ms 3416 KB Output is correct
10 Correct 2 ms 3412 KB Output is correct
11 Correct 2 ms 3452 KB Output is correct
12 Correct 2 ms 3412 KB Output is correct
13 Correct 2 ms 3412 KB Output is correct
14 Correct 2 ms 3412 KB Output is correct
15 Correct 3 ms 3460 KB Output is correct
16 Correct 2 ms 3456 KB Output is correct
17 Correct 2 ms 3456 KB Output is correct
18 Correct 2 ms 3412 KB Output is correct
19 Correct 2 ms 3412 KB Output is correct
20 Correct 2 ms 3412 KB Output is correct
21 Correct 2 ms 3412 KB Output is correct
22 Correct 2 ms 3456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 2 ms 3452 KB Output is correct
3 Correct 3 ms 3412 KB Output is correct
4 Correct 2 ms 3452 KB Output is correct
5 Correct 2 ms 3456 KB Output is correct
6 Correct 2 ms 3412 KB Output is correct
7 Correct 2 ms 3456 KB Output is correct
8 Correct 2 ms 3456 KB Output is correct
9 Correct 2 ms 3416 KB Output is correct
10 Correct 2 ms 3412 KB Output is correct
11 Correct 2 ms 3452 KB Output is correct
12 Correct 2 ms 3412 KB Output is correct
13 Correct 2 ms 3412 KB Output is correct
14 Correct 2 ms 3412 KB Output is correct
15 Correct 3 ms 3460 KB Output is correct
16 Correct 2 ms 3456 KB Output is correct
17 Correct 2 ms 3456 KB Output is correct
18 Correct 2 ms 3412 KB Output is correct
19 Correct 2 ms 3412 KB Output is correct
20 Correct 2 ms 3412 KB Output is correct
21 Correct 2 ms 3412 KB Output is correct
22 Correct 2 ms 3456 KB Output is correct
23 Correct 3 ms 3936 KB Output is correct
24 Correct 3 ms 3984 KB Output is correct
25 Correct 3 ms 3936 KB Output is correct
26 Correct 3 ms 3980 KB Output is correct
27 Correct 3 ms 3936 KB Output is correct
28 Correct 3 ms 3976 KB Output is correct
29 Correct 3 ms 3936 KB Output is correct
30 Correct 3 ms 3936 KB Output is correct
31 Correct 3 ms 3936 KB Output is correct
32 Correct 2 ms 3936 KB Output is correct
33 Correct 3 ms 3936 KB Output is correct
34 Correct 3 ms 3936 KB Output is correct
35 Correct 3 ms 3976 KB Output is correct
36 Correct 3 ms 3936 KB Output is correct
37 Correct 4 ms 3984 KB Output is correct
38 Correct 3 ms 3984 KB Output is correct
39 Correct 3 ms 3936 KB Output is correct
40 Correct 3 ms 3936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 2 ms 3452 KB Output is correct
3 Correct 3 ms 3412 KB Output is correct
4 Correct 2 ms 3452 KB Output is correct
5 Correct 2 ms 3456 KB Output is correct
6 Correct 2 ms 3412 KB Output is correct
7 Correct 2 ms 3456 KB Output is correct
8 Correct 2 ms 3456 KB Output is correct
9 Correct 2 ms 3416 KB Output is correct
10 Correct 2 ms 3412 KB Output is correct
11 Correct 2 ms 3452 KB Output is correct
12 Correct 2 ms 3412 KB Output is correct
13 Correct 2 ms 3412 KB Output is correct
14 Correct 2 ms 3412 KB Output is correct
15 Correct 3 ms 3460 KB Output is correct
16 Correct 2 ms 3456 KB Output is correct
17 Correct 2 ms 3456 KB Output is correct
18 Correct 2 ms 3412 KB Output is correct
19 Correct 2 ms 3412 KB Output is correct
20 Correct 2 ms 3412 KB Output is correct
21 Correct 2 ms 3412 KB Output is correct
22 Correct 2 ms 3456 KB Output is correct
23 Correct 3 ms 3936 KB Output is correct
24 Correct 3 ms 3984 KB Output is correct
25 Correct 3 ms 3936 KB Output is correct
26 Correct 3 ms 3980 KB Output is correct
27 Correct 3 ms 3936 KB Output is correct
28 Correct 3 ms 3976 KB Output is correct
29 Correct 3 ms 3936 KB Output is correct
30 Correct 3 ms 3936 KB Output is correct
31 Correct 3 ms 3936 KB Output is correct
32 Correct 2 ms 3936 KB Output is correct
33 Correct 3 ms 3936 KB Output is correct
34 Correct 3 ms 3936 KB Output is correct
35 Correct 3 ms 3976 KB Output is correct
36 Correct 3 ms 3936 KB Output is correct
37 Correct 4 ms 3984 KB Output is correct
38 Correct 3 ms 3984 KB Output is correct
39 Correct 3 ms 3936 KB Output is correct
40 Correct 3 ms 3936 KB Output is correct
41 Incorrect 3 ms 3468 KB Output isn't correct
42 Halted 0 ms 0 KB -