| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 141281 | meatrow | Collecting Mushrooms (NOI18_collectmushrooms) | C++17 | 40 ms | 5112 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
vector<vector<int>> f;
void add(int x, int y) {
for (int i = x; i < f.size(); i |= i + 1) {
for (int j = y; j < f[0].size(); j |= j + 1) {
f[i][j]++;
}
}
}
int get(int x, int y) {
x = min(x, int(f.size()) - 1);
y = min(y, int(f[0].size()) - 1);
int res = 0;
for (int i = x; i >= 0; i = (i & (i + 1)) - 1) {
for (int j = y; j >= 0; j = (j & (j + 1)) - 1) {
res += f[i][j];
}
}
return res;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int r, c, d, k;
cin >> r >> c >> d >> k;
vector<vector<char>> field(r, vector<char>(c));
f.assign(r, vector<int>(c, 0));
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
cin >> field[i][j];
if (field[i][j] == 'S') {
add(i, j);
}
}
}
int ans = 0;
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
if (field[i][j] == 'M') {
int cnt = get(i + d, j + d) - get(i + d, j - d - 1)
- get(i - d - 1, j + d) + get(i - d - 1, j - d - 1);
if (cnt >= k) {
ans++;
}
}
}
}
cout << ans;
return 0;
}컴파일 시 표준 에러 (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... | ||||
