# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
696771 | 2023-02-07T08:20:33 Z | Cross_Ratio | Toilets (JOI16_toilets) | C++14 | 2 ms | 3412 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=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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 3412 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 3412 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 3412 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |