답안 #733789

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
733789 2023-05-01T10:16:04 Z vjudge1 Collecting Mushrooms (NOI18_collectmushrooms) C++17
60 / 100
2000 ms 4692 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector <pair<ll,ll>> v;
ll r, c, d, k;
bool check(ll a, ll b) {
    if(a < r && b < c && a >= 0 && b >= 0) return 1;
    else return 0;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> r >> c;
    cin >> d >> k;
    ll b[r][c];
    for(ll i = 0; i < r; i++) {
        for(ll j = 0; j < c; j++) {
            b[i][j] = 0;
        }
    }
    char ch[r][c];
    for(ll i = 0; i < r; i++) {
        for(ll j = 0; j < c; j++) {
            cin >> ch[i][j];
            if(ch[i][j] == 'M') {
                v.push_back({i, j});
            }
            else if(ch[i][j] == 'S') {
                for(ll q = i - d; q <= i + d; q++) {
                    for(ll w = j - d; w <= j + d; w++) {
                        if(check(q, w) == 0) continue;
                        b[q][w]++;
                    }
                }
            }
        }
    }
    ll ans = 0;
    for(ll i = 0; i < v.size(); i++) {
        ll f = v[i].first;
        ll s = v[i].second;
        if(b[f][s] >= k) ans++;
    }
    cout << ans;
}

Compilation message

mushrooms.cpp: In function 'int main()':
mushrooms.cpp:39:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for(ll i = 0; i < v.size(); i++) {
      |                   ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 212 KB Output is correct
2 Correct 151 ms 604 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 11 ms 316 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 212 KB Output is correct
2 Correct 151 ms 604 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 11 ms 316 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 15 ms 212 KB Output is correct
7 Correct 49 ms 320 KB Output is correct
8 Correct 406 ms 340 KB Output is correct
9 Correct 17 ms 340 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 316 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 2248 KB Output is correct
2 Correct 106 ms 2296 KB Output is correct
3 Correct 18 ms 2760 KB Output is correct
4 Correct 362 ms 2228 KB Output is correct
5 Correct 6 ms 2456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2086 ms 4692 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 212 KB Output is correct
2 Correct 151 ms 604 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 11 ms 316 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 15 ms 212 KB Output is correct
7 Correct 49 ms 320 KB Output is correct
8 Correct 406 ms 340 KB Output is correct
9 Correct 17 ms 340 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 1 ms 316 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 ms 724 KB Output is correct
14 Correct 1 ms 316 KB Output is correct
15 Correct 1 ms 584 KB Output is correct
16 Correct 58 ms 2248 KB Output is correct
17 Correct 106 ms 2296 KB Output is correct
18 Correct 18 ms 2760 KB Output is correct
19 Correct 362 ms 2228 KB Output is correct
20 Correct 6 ms 2456 KB Output is correct
21 Execution timed out 2086 ms 4692 KB Time limit exceeded
22 Halted 0 ms 0 KB -