Submission #921521

#TimeUsernameProblemLanguageResultExecution timeMemory
921521vjudge1Collecting Mushrooms (NOI18_collectmushrooms)C++17
60 / 100
2041 ms5336 KiB
#include <bits/stdc++.h> #define F first #define S second #define ent '\n' #define int long long #define pb push_back typedef long double ld; typedef long long ll; using namespace std; const int maxn = 1e6+12; const int T = 0; const int mod = 1e9+7; int n,m,k,x,y,l,r; int b[maxn],p[maxn],pref[maxn],fact[maxn]; char a[2222][2222]; void solve(){ cin>>n>>m>>k>>x; int ans=0; vector<pair<int,int>>v; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>a[i][j]; if(a[i][j]=='S'){ v.pb({i,j}); } } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(a[i][j]=='M'){ int cal=0; for(int u=0;u<v.size();u++){ if(max(abs(i-v[u].F) , abs(j-v[u].S)) <= k)cal++; } if(cal>=x)ans++; } } } cout<<ans; } //BEKSULTAN TOP signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; if(T)cin>>t; while(t--)solve(); }

Compilation message (stderr)

mushrooms.cpp: In function 'void solve()':
mushrooms.cpp:36:18: 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]
   36 |     for(int u=0;u<v.size();u++){
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...