# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
696774 | Cross_Ratio | Toilets (JOI16_toilets) | C++14 | 4 ms | 3984 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 <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 (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... |