# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
224921 | 2020-04-19T05:54:45 Z | Nightlight | Collecting Mushrooms (NOI18_collectmushrooms) | C++14 | 22 ms | 8320 KB |
#include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second using namespace std; int R, C, D, K, P, ans; vector<vector<int>> pre; pii mus[500005]; char t; int getsum(int x,int y) { int y1 = min(y + D, C), y0 = max(y - D - 1, 0); int x1 = min(x + D, R), x0 = max(x - D - 1, 0); return pre[x1][y1] - pre[x1][y0] - pre[x0][y1] + pre[x0][y0]; } int main() { scanf("%d %d %d %d", &R, &C, &D, &K); pre.resize(R + 5); pre[0].resize(C + 5); getchar(); for(int i = 1; i <= R; i++) { pre[i].resize(C + 5); for(int j = 1; j <= C; j++) { pre[i][j] = pre[i - 1][j] + pre[i][j - 1] - pre[i - 1][j - 1]; t = getchar(); if(t == 'M') { mus[++P] = {i, j}; }else if(t == 'S') { pre[i][j]++; } } getchar(); } for(int i = 1; i <= P; i++) { if(getsum(mus[i].x, mus[i].y) >= K) ans++; } printf("%d\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 7 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 7 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 7 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 512 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 1280 KB | Output is correct |
2 | Correct | 8 ms | 1280 KB | Output is correct |
3 | Correct | 9 ms | 1536 KB | Output is correct |
4 | Correct | 8 ms | 1408 KB | Output is correct |
5 | Correct | 8 ms | 1408 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 6016 KB | Output is correct |
2 | Correct | 22 ms | 8320 KB | Output is correct |
3 | Correct | 20 ms | 7436 KB | Output is correct |
4 | Correct | 18 ms | 6272 KB | Output is correct |
5 | Correct | 20 ms | 7936 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 7 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 7 ms | 384 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 5 ms | 512 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 8 ms | 1280 KB | Output is correct |
17 | Correct | 8 ms | 1280 KB | Output is correct |
18 | Correct | 9 ms | 1536 KB | Output is correct |
19 | Correct | 8 ms | 1408 KB | Output is correct |
20 | Correct | 8 ms | 1408 KB | Output is correct |
21 | Correct | 17 ms | 6016 KB | Output is correct |
22 | Correct | 22 ms | 8320 KB | Output is correct |
23 | Correct | 20 ms | 7436 KB | Output is correct |
24 | Correct | 18 ms | 6272 KB | Output is correct |
25 | Correct | 20 ms | 7936 KB | Output is correct |
26 | Correct | 17 ms | 4992 KB | Output is correct |
27 | Correct | 16 ms | 4480 KB | Output is correct |
28 | Correct | 16 ms | 3584 KB | Output is correct |
29 | Correct | 15 ms | 3328 KB | Output is correct |
30 | Correct | 18 ms | 4884 KB | Output is correct |