# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
91609 | 2018-12-28T16:22:23 Z | model_code | Collecting Mushrooms (NOI18_collectmushrooms) | C++17 | 33 ms | 4472 KB |
#include <bits/stdc++.h> using namespace std; vector<vector<char> > board; vector<vector<int> > psum; int n,m; int sum(int a,int b){ if(a<0 || b<0)return 0; a=min(a,n-1);b=min(b,m-1); return psum[a][b]; } int sum(int a,int b,int c,int d){ return sum(c,d)-sum(a-1,d)-sum(c,b-1)+sum(a-1,b-1); } int main(){ //freopen("hi.txt","r",stdin); int k,d; scanf("%d%d%d%d",&n,&m,&d,&k); board.resize(n); psum.resize(n); for(int i=0;i<n;i++){ board[i].resize(m); psum[i].resize(m); } char str[500010]; for(int i=0;i<n;i++){ scanf("%s",str); for(int j=0;j<m;j++){ board[i][j]=str[j]; psum[i][j]=sum(i-1,j)+sum(i,j-1)-sum(i-1,j-1); psum[i][j]+=board[i][j]=='S'; } } int ans=0; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(board[i][j]=='M'){ ans+=sum(i-d,j-d,i+d,j+d)>=k; } } } printf("%d\n",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 420 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 296 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 420 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 296 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1244 KB | Output is correct |
2 | Correct | 5 ms | 1400 KB | Output is correct |
3 | Correct | 6 ms | 1528 KB | Output is correct |
4 | Correct | 5 ms | 1372 KB | Output is correct |
5 | Correct | 6 ms | 1400 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 3192 KB | Output is correct |
2 | Correct | 14 ms | 3192 KB | Output is correct |
3 | Correct | 14 ms | 3192 KB | Output is correct |
4 | Correct | 11 ms | 3192 KB | Output is correct |
5 | Correct | 14 ms | 3192 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 420 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 296 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 5 ms | 1244 KB | Output is correct |
17 | Correct | 5 ms | 1400 KB | Output is correct |
18 | Correct | 6 ms | 1528 KB | Output is correct |
19 | Correct | 5 ms | 1372 KB | Output is correct |
20 | Correct | 6 ms | 1400 KB | Output is correct |
21 | Correct | 11 ms | 3192 KB | Output is correct |
22 | Correct | 14 ms | 3192 KB | Output is correct |
23 | Correct | 14 ms | 3192 KB | Output is correct |
24 | Correct | 11 ms | 3192 KB | Output is correct |
25 | Correct | 14 ms | 3192 KB | Output is correct |
26 | Correct | 18 ms | 4472 KB | Output is correct |
27 | Correct | 13 ms | 2808 KB | Output is correct |
28 | Correct | 12 ms | 2680 KB | Output is correct |
29 | Correct | 11 ms | 2808 KB | Output is correct |
30 | Correct | 33 ms | 3960 KB | Output is correct |