# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1006077 | 2024-06-23T11:09:14 Z | andecaandeci | Collecting Mushrooms (NOI18_collectmushrooms) | C++17 | 26 ms | 20428 KB |
#include<bits/stdc++.h> #define fi first #define se second using namespace std; int main() { int r, c, d, p, ans=0; scanf("%d %d %d %d", &r, &c, &d, &p); char s[r+5][c+5]; int pref[r+5][c+5]; vector<pair<int, int> >v; memset(pref, 0, sizeof(pref)); for(int i=1; i<=r; i++) { for(int j=1; j<=c; j++) { scanf("%c", &s[i][j]); if(s[i][j]=='M') { v.push_back({i, j}); } if(s[i][j]=='S')pref[i][j]++; pref[i][j]+=(pref[i-1][j]+pref[i][j-1]); } } for(int i=0; i<v.size(); i++) { if(pref[min(r, v[i].fi+d)][min(c, v[i].se+d)]-pref[max(0, v[i].fi-d-1)][min(c, v[i].se+d)]-pref[min(r, v[i].fi+d)][max(0, v[i].se-d-1)]+pref[max(0, v[i].fi-d-1)][max(0, v[i].se-d-1)]>=p) { ans++; } } printf("%d\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 1372 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 17220 KB | Output is correct |
2 | Correct | 26 ms | 20428 KB | Output is correct |
3 | Incorrect | 25 ms | 20428 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |