# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
333490 | 2020-12-06T13:38:48 Z | fadi57 | Collecting Mushrooms (NOI18_collectmushrooms) | C++14 | 4 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mx=109; const int mod= 998244353; const ll inf=2*1e16+9; int r,c,d,k; int a[mx][mx]; ll pref[mx][mx]; int get(int i){ } int main() { cin>>r>>c>>d>>k; for(int i=1;i<=r;i++){ for(int j=1;j<=c;j++){ char x;cin>>x; if(x=='.'){ a[i][j]=0; }else if(x=='M'){ a[i][j]=1; }else{ a[i][j]=2; } } } for(int i=1;i<=r;i++){ for(int j=1;j<=c;j++){ if(a[i][j]==2){ int uper=max(i-d,1); int left=max(j-d,1); // cout<<"hi"<<uper<<" "<<left<<endl; int right=j+d+1; int down=i+d+1; pref[uper][left]++; pref[uper][right]--; pref[down][left]--; pref[down][right]++; } } } for(int i=1;i<=r;i++){ for(int j=1;j<=c;j++){ pref[i][j]+=pref[i-1][j]+pref[i][j-1]-pref[i-1][j-1]; } }int ans=0; for(int i=1;i<=r;i++){ for(int j=1;j<=c;j++){ // cout<<pref[i][j]<<" "; ans+=(pref[i][j]==k&&a[i][j]==1); } cout<<endl; } cout<<ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 492 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |