Submission #696774

#TimeUsernameProblemLanguageResultExecution timeMemory
696774Cross_RatioToilets (JOI16_toilets)C++14
36 / 100
4 ms3984 KiB
#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)

toilets.cpp: In function 'int main()':
toilets.cpp:12:12: warning: unused variable 'j' [-Wunused-variable]
   12 |     int i, j;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...