이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define oset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
template<typename... T>
void see(T&... args) {((cin >> args), ...);}
template<typename... T>
void put(T&&... args) {((cout << args << ' '), ...);}
template<typename... T>
void putl(T&&... args) {((cout << args << ' '), ...); cout << '\n';}
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define F first
#define S second
#define ii pair<int, int>
#define vt vector
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz size()
#define endl '\n'
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define rev(i,b,a) for(int i=b; i>=a; i--)
#define reada(a,x,y) for(int i=x; i<=y; i++){cin >> a[i];}
const ll INF = INT_MAX;
const ll M = 1e9+7;
const int Mxn = 1e6, Nxn = 2*1e5, Mxm = 1e5, Nxm = 1005, Dxn = 1e9+1;
vt< ii > m, s;
int ans[Mxn];
void solve() {
int r, c, k, d;
see(r, c, d, k);
rep(i,1,r) {
rep(j,1,c) {
char x; see(x);
if(x == 'M') m.pb({i, j});
if(x == 'S') s.pb({i, j});
}
}
for(int i = 0; i < s.size(); i++) {
int x1 = s[i].F - d, x2 = s[i].F + d, y1 = s[i].S - d, y2 = s[i].S + d;
for(int j = 0; j < m.size(); j++) {
int x = m[j].F, y = m[j].S;
if(x1 <= x && x2 >= x && y1 <= y && y2 >= y) {
ans[j]++;
}
}
}
int s = 0;
for(int j = 0; j < m.size(); j++) {
if(ans[j] >= k) s++;
}
cout << s;
return;
}
signed main() { IOS
int t=1;
//cin >> t;
while(t--) {
solve();
cout << endl;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
mushrooms.cpp: In function 'void solve()':
mushrooms.cpp:53:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
53 | for(int i = 0; i < s.size(); i++) {
| ~~^~~~~~~~~~
mushrooms.cpp:56:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
56 | for(int j = 0; j < m.size(); j++) {
| ~~^~~~~~~~~~
mushrooms.cpp:65:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
65 | for(int j = 0; j < m.size(); j++) {
| ~~^~~~~~~~~~
# | 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... |