답안 #534064

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
534064 2022-03-07T23:26:39 Z gilbirb Collecting Mushrooms (NOI18_collectmushrooms) C++14
60 / 100
2000 ms 8500 KB
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
typedef long long ll;
using namespace std;

struct range{
	ll x1,x2,y1,y2;
};

ll r, c, d, k, ans;
vector<range>vec;
vector<pair<ll,ll>>shroom;
map<pair<ll,ll>,ll>mp;

bool inside(ll x, ll y){
	return (x >= 1 && y >= 1 && x <= r && y <= c);
}

void check(ll x, ll y){
	for(range z : vec){
		if(x >= z.x1 && x <= z.x2 && y >= z.y1 && y <= z.y2){
			mp[{x,y}]++;
			if(mp[{x,y}] == k){
				ans++;
			}
		}
	}
}

int main(){
	cin >> r >> c >> d >> k;
	vector<pair<ll,ll>>spr;
	for(int i = 1; i <= r; i++){
		for(int j = 1; j <= c; j++){
			char f; cin >> f;
			if(f == 'M'){
				shroom.pb({i,j});
			}
			else if(f == 'S'){
				range x;
				x.x1 = i-d; x.x2 = i+d; x.y1 = j-d; x.y2 = j+d;
				vec.pb(x);
			}
		}
	}
	for(pair<ll,ll> x : shroom){
		check(x.fi, x.se);
	}
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 979 ms 664 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 19 ms 416 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 979 ms 664 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 19 ms 416 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 272 ms 588 KB Output is correct
9 Correct 74 ms 452 KB Output is correct
10 Correct 4 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 5 ms 460 KB Output is correct
3 Correct 9 ms 588 KB Output is correct
4 Correct 1 ms 292 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 460 KB Output is correct
2 Correct 13 ms 520 KB Output is correct
3 Correct 15 ms 552 KB Output is correct
4 Correct 22 ms 540 KB Output is correct
5 Correct 12 ms 400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2072 ms 8500 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 979 ms 664 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 19 ms 416 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 272 ms 588 KB Output is correct
9 Correct 74 ms 452 KB Output is correct
10 Correct 4 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 5 ms 460 KB Output is correct
13 Correct 9 ms 588 KB Output is correct
14 Correct 1 ms 292 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 12 ms 460 KB Output is correct
17 Correct 13 ms 520 KB Output is correct
18 Correct 15 ms 552 KB Output is correct
19 Correct 22 ms 540 KB Output is correct
20 Correct 12 ms 400 KB Output is correct
21 Execution timed out 2072 ms 8500 KB Time limit exceeded
22 Halted 0 ms 0 KB -