답안 #697408

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
697408 2023-02-09T17:18:10 Z vjudge1 Collecting Mushrooms (NOI18_collectmushrooms) C++17
79 / 100
12 ms 5588 KB
#include <bits/stdc++.h>

using namespace std;

int t[10000][10000];
char cc[10000][10000];

int main(){
    cin.tie(0)->sync_with_stdio(0);
    int r,c,d,k,cnt=0,i,j;
    cin>>r>>c>>d>>k;
    for(i=1;i<=r;i++){
        for(j=1;j<=c;j++){
            cin>>cc[i][j];
            if(cc[i][j]=='S'){
                int ar=i-d,ac=j-d,br=i+d,bc=j+d;
                if(ar<1)ar=1;
                if(ac<1)ac=1;
                if(br>r)br=r;
                if(bc>c)bc=c;
                t[ar][ac]++;
                t[ar][bc+1]--;
                t[br+1][ac]--;
                t[br+1][bc+1]++;
            }
        }
    }
    for(i=1;i<=r;i++){
        for(j=1;j<=c;j++){
            t[i][j]+=t[i-1][j]+t[i][j-1]-t[i-1][j-1];
            if(cc[i][j]=='M'&&t[i][j]>=k) cnt++;
        }
    }
    /*for(i=1;i<=r;i++){
        for(j=1;j<=c;j++){
            cout<<t[i][j];
        }
        cout<<"\n";
    }*/
    cout<<cnt;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 1108 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 1 ms 1124 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4696 KB Output is correct
2 Correct 5 ms 5076 KB Output is correct
3 Correct 6 ms 5588 KB Output is correct
4 Correct 5 ms 4692 KB Output is correct
5 Correct 6 ms 5204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 2772 KB Output is correct
2 Correct 9 ms 2772 KB Output is correct
3 Correct 9 ms 2772 KB Output is correct
4 Correct 11 ms 2720 KB Output is correct
5 Correct 12 ms 2792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 1108 KB Output is correct
9 Correct 1 ms 852 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 724 KB Output is correct
12 Correct 1 ms 852 KB Output is correct
13 Correct 1 ms 1124 KB Output is correct
14 Correct 1 ms 724 KB Output is correct
15 Correct 1 ms 1108 KB Output is correct
16 Correct 5 ms 4696 KB Output is correct
17 Correct 5 ms 5076 KB Output is correct
18 Correct 6 ms 5588 KB Output is correct
19 Correct 5 ms 4692 KB Output is correct
20 Correct 6 ms 5204 KB Output is correct
21 Correct 12 ms 2772 KB Output is correct
22 Correct 9 ms 2772 KB Output is correct
23 Correct 9 ms 2772 KB Output is correct
24 Correct 11 ms 2720 KB Output is correct
25 Correct 12 ms 2792 KB Output is correct
26 Runtime error 11 ms 416 KB Execution killed with signal 11
27 Halted 0 ms 0 KB -