Submission #733811

# Submission time Handle Problem Language Result Execution time Memory
733811 2023-05-01T10:35:40 Z vjudge1 Collecting Mushrooms (NOI18_collectmushrooms) C++17
19 / 100
2000 ms 4944 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector <pair<ll,ll>> v;
ll r, c, d, li;
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 >> li;
    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});
            }
        }
    }
    ll ss, ans = 0, t = 0;
    for(ll i = 0; i < v.size(); i++) {
        ll f = v[i].first;
        ll s = v[i].second;
        ss = 0;
        for(ll k = f - d; k <= f + d; k++) {
            if(t == 1) {
                t = 0;
                break;
            }
            for(ll q = s - d; q <= s + d; q++) {
                if(!check(k, q)) continue;
                if(ch[k][q] == 'S') ss++;
                if(ss >= li) {
                    ans++;
                    t = 1;
                    break;
                }
            }
        }
    }
    cout << ans;
}

Compilation message

mushrooms.cpp: In function 'int main()':
mushrooms.cpp:25: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]
   25 |     for(ll i = 0; i < v.size(); i++) {
      |                   ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 36 ms 432 KB Output is correct
3 Correct 37 ms 424 KB Output is correct
4 Correct 12 ms 340 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 36 ms 432 KB Output is correct
3 Correct 37 ms 424 KB Output is correct
4 Correct 12 ms 340 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 61 ms 356 KB Output is correct
9 Correct 33 ms 336 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 264 ms 500 KB Output is correct
2 Correct 50 ms 468 KB Output is correct
3 Correct 13 ms 572 KB Output is correct
4 Correct 253 ms 512 KB Output is correct
5 Incorrect 6 ms 468 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2052 ms 4944 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 36 ms 432 KB Output is correct
3 Correct 37 ms 424 KB Output is correct
4 Correct 12 ms 340 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 61 ms 356 KB Output is correct
9 Correct 33 ms 336 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -