# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1011352 |
2024-06-30T12:20:09 Z |
pcc |
Telegraph (JOI16_telegraph) |
C++17 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
string s;
vector<ll> pos[2];
ll N,M;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>N>>M;
if(N>1e6)return 0;
for(int i = 0;i<M;i++){
string t;
int c;
cin>>t>>c;
while(c--)s += t;
}
reverse(s.begin(),s.end());
ll sum = 0,ans = 0;
for(auto &i:s){
if(i == 'F'){
sum--;
ans = max(ans,sum);
}
else sum++;
}
if(sum>0)cout<<"-1\n";
else cout<<ans<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |