| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 547792 | unicornboy | Collecting Mushrooms (NOI18_collectmushrooms) | C++14 | 2072 ms | 3764 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
using namespace std;
const int N=5e5+1;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
ll n , m , d , k;
cin >> n >> m >> d >> k ;
vector<pair<int,int>>mushrooms;
vector<pair<int,int>>sprinklers;
for (int i=0;i<n;i++)
{
for (int j=0;j<m;j++)
{
char c;
cin >> c ;
if(c=='M')
{
mushrooms.pb({i,j});
}
else if (c=='S')
{
sprinklers.pb({i,j});
}
}
}
// iterate on each sprinkler for each mushroom
int ans=0;
for (int i=0;i<mushrooms.size();i++)
{
int count=0;
for (int j=0;j<sprinklers.size();j++)
{
int dis=max(abs(sprinklers[j].ff-mushrooms[i].ff),abs(sprinklers[j].ss-mushrooms[i].ss));
if(dis<=d)
{
count++;
}
if(count>=k)
break;
}
if(count>=k)
ans++;
}
cout<<ans<<"\n";
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
