Submission #921575

#TimeUsernameProblemLanguageResultExecution timeMemory
921575vjudge1Collecting Mushrooms (NOI18_collectmushrooms)C++17
18 / 100
2047 ms7620 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; void solve(){ ll a,b,d,k; cin>>a>>b>>d>>k; vector<pair<ll,ll> >v,l; char c[a+1][b+1]; for(ll i=1;i<=a;i++){ for(ll j=1;j<=b;j++){ cin>>c[i][j]; } } for(ll i=1;i<=a;i++){ for(ll j=1;j<=b;j++){ //cin>>c[i][j]; if(c[i][j]=='S'){ v.pb({i,j}); } else if(c[i][j]=='M'){ l.pb({i,j}); } } } ll ans=0,count=0; for(ll i=0;i<l.size();i++){ ans=0; for(ll j=0;j<v.size();j++){ ll res=0; res=sqrt(pow((v[j].first-l[i].first),2)+pow((v[j].second-l[i].second),2)); if(res<=d){ ans++; } if(ans>=k){ count++; break; } } } cout<<count; } int main() { ios_base::sync_with_stdio(0),cin.tie(0); ll t=1,i=1; //cin>>t; while(t--){ //cout<<"Case "; //cout<<i<<':'<<"\n"; //i++; solve(); } return 0; }

Compilation message (stderr)

mushrooms.cpp: In function 'void solve()':
mushrooms.cpp:28:17: 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]
   28 |     for(ll i=0;i<l.size();i++){
      |                ~^~~~~~~~~
mushrooms.cpp:30: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]
   30 |         for(ll j=0;j<v.size();j++){
      |                    ~^~~~~~~~~
mushrooms.cpp: In function 'int main()':
mushrooms.cpp:48:12: warning: unused variable 'i' [-Wunused-variable]
   48 |     ll t=1,i=1;
      |            ^
#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...