답안 #733819

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
733819 2023-05-01T10:42:04 Z vjudge1 Collecting Mushrooms (NOI18_collectmushrooms) C++17
9 / 100
2000 ms 4940 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 ans = 0, checker = 0;
    for(ll i = 0; i < v.size(); i++) {
        ll s = 0;
        for(ll k = v[i].first - d; k <= v[i].first + d; k++) {
            if(checker == 1) {
                checker = 0;
                break;
            }
            for(ll q = v[i].second - d; q <= v[i].second + d; q++) {
                if(check(k, q) == 0) continue;
                if(ch[k][q] == 'S') s++;
                if(s == k) {
                    ans++;
                    checker = 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++) {
      |                   ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 31 ms 340 KB Output is correct
3 Correct 33 ms 340 KB Output is correct
4 Correct 12 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 31 ms 340 KB Output is correct
3 Correct 33 ms 340 KB Output is correct
4 Correct 12 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Incorrect 1 ms 340 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 56 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2074 ms 4940 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 31 ms 340 KB Output is correct
3 Correct 33 ms 340 KB Output is correct
4 Correct 12 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Incorrect 1 ms 340 KB Output isn't correct
7 Halted 0 ms 0 KB -