답안 #1113671

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113671 2024-11-17T03:32:44 Z vjudge1 Collecting Mushrooms (NOI18_collectmushrooms) C++17
19 / 100
12 ms 5232 KB
#include <bits/stdc++.h>
using namespace std;

#define i128 __int128
#define ll long long
#define ff first
#define ss second
#define pll pair<ll, ll>
#define pb push_back
#define elif else if

#define fast_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const ll MOD = 1e9+7;
const ll base = 1e18;
const ll maxn = 5e5+5;

ll p[maxn];

int main(){
    fast_io;
    ll r,c,d,k;
    cin>>r>>c>>d>>k;
    vector<vector<char>> a(r, vector<char> (c));
    for (int i=0;i<c;i++){
        cin>>a[0][i];
        //cout<<a[0][i]<<endl;
        if (a[0][i]=='S'){
            //range 
            ll start = max(0ll, i - d); 
            ll end = min(c-1,i + d);
            p[start]=p[start]+1;
            p[end+1]=p[end+1]-1;
            //cout<<start<<" "<<end<<endl;
            //the range of the boundary is 0->c-1

        }
    }
    for (int i=1;i<c;i++){
        p[i]=p[i]+p[i-1];
    }
    ll ans=0;
    for (int i=0;i<c;i++){
        if (a[0][i]=='M'&&p[i]>=k){
            ans++;
        }
        //cout<<p[i]<<endl;
    }
    cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 5220 KB Output is correct
2 Correct 9 ms 5220 KB Output is correct
3 Correct 9 ms 5220 KB Output is correct
4 Correct 12 ms 5220 KB Output is correct
5 Correct 10 ms 5232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -