QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#797343 | #3251. 数正方体 | hcywoi | AC ✓ | 1ms | 4032kb | C++23 | 1.0kb | 2024-12-02 21:10:37 | 2024-12-02 21:10:44 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, m;
std::cin >> n >> m;
std::vector<std::string> s(n);
getline(std::cin, s[0]);
for (int i = 0; i < n; i++) {
getline(std::cin, s[i]);
}
int cnt = 0;
for (int i = m - 1; i >= 0; i--) {
if (s.back()[i] != '.') {
break;
}
cnt++;
}
int r = cnt / 2, c = (m - cnt - 1) / 4;
std::vector A(r + 1, std::vector<int>(c));
for (int i = r - 1; i >= 0; i--) {
for (int j = 0; j < c; j++) {
A[i][j] = A[i + 1][j];
int R = 2 * (r - 1 - i) + A[i][j] * 3;
int C = 2 * (r - 1 - i) + (j + 1) * 4;
for (int k = n - R - 1; k >= 0; k -= 3) {
if (s[k][C] != '+') {
break;
}
A[i][j]++;
}
A[i][j]--;
}
}
int ans = 0;
for (int i = 0; i < r; i++) {
ans += std::accumulate(A[i].begin(), A[i].end(), 0);
}
std::cout << ans << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3700kb
input:
371 259 ......................................................................+---+---+.................................................................................................................................................................................... ...................................
output:
84826
result:
ok single line: '84826'
Test #2:
score: 0
Accepted
time: 1ms
memory: 4032kb
input:
398 301 ....................................................................................................+---+..............................................................................................................................................................................................
output:
128658
result:
ok single line: '128658'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
401 301 ....................................................................................................+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---...
output:
250000
result:
ok single line: '250000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
401 301 ....................................................................................................+---+---+---+---+---+---+---+---+---+---+---+......................................................................................................................................................
output:
144484
result:
ok single line: '144484'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
395 235 ..............................................................................................+---+---+.................................................................................................................................... ...........................................................
output:
82548
result:
ok single line: '82548'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
401 301 ....................................................................................................+---+---+---+......................................................................................................................................................................................
output:
125068
result:
ok single line: '125068'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
367 259 ..................................................................+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+................................................................................................................................ ...................................
output:
80503
result:
ok single line: '80503'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
397 229 ................................................................................................+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+.................................................................... .................................................................
output:
82439
result:
ok single line: '82439'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
401 301 ....................................................................................................+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+......................................................................................................................
output:
127263
result:
ok single line: '127263'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
398 301 ....................................................................................................+---+..............................................................................................................................................................................................
output:
151454
result:
ok single line: '151454'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
398 301 ....................................................................................................+---+---+---+---+---+---+---+---+---+---+..........................................................................................................................................................
output:
182883
result:
ok single line: '182883'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
401 301 ....................................................................................................+---+---+---+---+---+---+---+---+---+---+---+......................................................................................................................................................
output:
209274
result:
ok single line: '209274'