This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// By ObeliX
#include <bits/stdc++.h>
#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#include <unordered_map>
#include <cstddef>
#include <cassert>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
const long long N = 1e6 + 5;
const long long MOD = 1e7 + 7;
const long long inf = 1e18;
long long n , m , d , k;
char c[5001][5001];
int main(){
//freopen( "cinema.in" , "r" , stdin );
//freopen( "cinema.out" , "w" , stdout );
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> d >> k;
long long cnt1 = 0 , cnt2 = 0;
for ( int i = 1 ; i <= n ; i++ ) {
for ( int j = 1 ; j <= m ; j++ ) {
cin >> c[i][j];
if ( c[i][j] == 'S' ) {
cnt1++;
}
if ( c[i][j] == 'M' ) {
cnt2++;
}
}
}
if ( d == max( n , m ) && cnt1 >= k ) {
if ( cnt1 > 0 ) {
cout << cnt2 ;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |