QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#119918 | #1993. Equilateral Triangles | bashkort | 100 ✓ | 252ms | 6724kb | C++20 | 1.3kb | 2023-07-06 03:11:41 | 2023-07-06 03:11:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int N = 301;
int a[N * 2][N * 2], c[N * 2][N * 2];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<pair<int, int>> cows;
for (int i = 0; i < n; ++i) {
string s;
cin >> s;
for (int j = 0; j < n; ++j) {
if (s[j] == '*') {
cows.push_back({i + j, i - j + n});
}
}
}
int ans = 0;
for (int t = 0; t < 4; ++t) {
memset(a, 0, sizeof(a)), memset(c, 0, sizeof(c));
for (auto &[x, y] : cows) {
a[x][y] = c[x][y] = 1;
}
for (int i = 0; i < 2 * n; ++i) {
for (int j = 1; j < 2 * n; ++j) {
a[i][j] += a[i][j - 1];
}
}
for (int len = 1; len <= 2 * (n - 1); ++len) {
for (auto [x, y] : cows) {
if (y + len < 2 * n && x - len >= 0) {
int now = c[x][y + len] * (a[x - len][y + len - 1] - (y == 0 ? 0 : a[x - len][y - 1]));
ans += now;
}
}
}
for (auto &[x, y] : cows) {
int i = x, j = y;
x = j, y = 2 * n - 1 - i;
}
}
cout << ans << '\n';
return 0;
}
詳細信息
Test #1:
score: 6.66667
Accepted
time: 1ms
memory: 6212kb
input:
3 *.. .*. *..
output:
1
result:
ok single line: '1'
Test #2:
score: 6.66667
Accepted
time: 1ms
memory: 6320kb
input:
50 *****.*********.******.*******.********.*.***.**** **.*****.*..******************.*.****.***.******** ********.**.****.**.*******..*******.*..*.******** *****.**.****.********.*.**.*****.****.*.********* *************.*.*.****.*****.*.*.**.***********.*. ******..*.**************.*********.*******...
output:
436237
result:
ok single line: '436237'
Test #3:
score: 6.66667
Accepted
time: 3ms
memory: 6428kb
input:
75 ********..**...*********..******.*********************.**.**********.*.**** *******.**.***********************..*..***.****.*********...**********.*.*. ********.*********.**.******.***..*****.*************.*.******.*****...*.** *****.****.**.***.****.***********************.****...********.******...
output:
2284176
result:
ok single line: '2284176'
Test #4:
score: 6.66667
Accepted
time: 9ms
memory: 6424kb
input:
100 .********.****.**.*******.*********..*.**************.**...***..*..**..**.*.*****..*.**.***.***.*.** **************.**.****.**********.**********************.******.*****.***.*..****.**.*****.****.**** *********.*****.**.**..******.******.*****..**.**.***********.*******.******.*..**.*****.*****...
output:
7251584
result:
ok single line: '7251584'
Test #5:
score: 6.66667
Accepted
time: 16ms
memory: 6368kb
input:
125 .***************.*****.***.*.**.*.****....**.**.***.****.**.*.**.************.******..******.**********.*****************.*** ...********..***.***.******.*********.*****.*.***.****.*****.**********.**.****.*.*******.*****.****.******.*************.*.* *.*.**.*****.*.****..***.**.****************...
output:
17359107
result:
ok single line: '17359107'
Test #6:
score: 6.66667
Accepted
time: 22ms
memory: 6396kb
input:
150 *******..**.***********************..*****.*.*********.************************.***.**.*.*.*********.*******..***.****.*.*..*.*.*******.**********.*** *******************..*.*.***..***.***.***.************.******.**.*.*******.*******..*.**.****.***.*****..******.**.*****.*****************..**.**...
output:
35462232
result:
ok single line: '35462232'
Test #7:
score: 6.66667
Accepted
time: 39ms
memory: 6420kb
input:
175 *******....********.*.****..**********************.*.**..***.***..**.**...********..***.****.*****.*********....****.*********.**.**********.*****.***..****.*.**.***********.* ***.**.*************************..******.*****.****..******...***.*******.*..***....*****.**..*.************.***.*.***.....
output:
67053953
result:
ok single line: '67053953'
Test #8:
score: 6.66667
Accepted
time: 60ms
memory: 6356kb
input:
200 **.*******.*****************.******..*****.***.*.************.**********..****.**********..***.**********.**.****.***.....*****..*******.*..***.***.**.*****.**..*******.****..*****************.******* ..**.*.********.*.****.*.*********.**.**.****.**.*******.****.*.********.**.***.*.******.*****....
output:
114032086
result:
ok single line: '114032086'
Test #9:
score: 6.66667
Accepted
time: 95ms
memory: 6416kb
input:
225 *.********.****.*****.****.**..*.**..******.**.*.**********.*****.*****.***.*****.*.***.**.***..***.**.*******..**.**.*****..*.*******.****..***.*******.**..******.***********.************.****************.*.***.***.******.** ************.***.***.*.********.****..*.***.*****..***.**********.****...
output:
181903198
result:
ok single line: '181903198'
Test #10:
score: 6.66667
Accepted
time: 129ms
memory: 6396kb
input:
250 .*.********.*.**..*******.*...*******.************..***************.*.**.***.**.**.******************.*****.****.****..****.*.*..**************.*..*..**.**.**.****.****.***.**********.*..*******.************.*.****.*..*****.***.*.*..***.*********..** ***.**********.*.****.*******.*.**.******.***...
output:
277649728
result:
ok single line: '277649728'
Test #11:
score: 6.66667
Accepted
time: 185ms
memory: 6460kb
input:
275 ********..**...*.********.**************************.*.******.*...********.*****.**.*******.**.***************.********.**..*.**********.**...*************.**.*****..*******.***.***.****.**.****.*.***.**.*******.*.*****.****.**.*******.*********.**.**.....**...**.********.*. ************.**.**.*...
output:
404298108
result:
ok single line: '404298108'
Test #12:
score: 6.66667
Accepted
time: 249ms
memory: 6432kb
input:
300 ******.*************.**.***..**...****..*****.**.****.*.**.*********.***.**********.**.***.*******..****.****.*.**...***...****.**.***************.*********.*.*..**.**.****.***..****.*******.***.*.***.**...*..***.****.*.***.**.************..*.*.*********.**...**********.********..*..*.********.....
output:
569554456
result:
ok single line: '569554456'
Test #13:
score: 6.66667
Accepted
time: 249ms
memory: 6724kb
input:
300 *..*******.******.*****************.*********.********..********.******.*.*..****..*********************..****.**.**.***.*****...***.*************.*.*..****.***.**.*..*.*..************.***.**.**.************.*****.*****..*.*****.*.*.****.********.*****..**.*..*.***..*.***..***.*.********.******....
output:
575907601
result:
ok single line: '575907601'
Test #14:
score: 6.66667
Accepted
time: 239ms
memory: 6660kb
input:
300 **.***.*.**********.***..***..********.*****.*******.**.******.*************..****.*..********.***.***.*********.*****.****.*****.***...*.*******.*.****.**********.*****.*..***.*****.*******..*****.******..*.*.*.***...***..**.*******.*..*.*****..*.**..**********.*.**..*****..*****...******.***.*...
output:
575845244
result:
ok single line: '575845244'
Test #15:
score: 6.66667
Accepted
time: 252ms
memory: 6404kb
input:
300 ***.********.*..******.********..******..***************.****.*.***..***.***********..******.***.*********.*.**********..******.**.*.*****.***..*.*.*...******.**.*****.***.****************.******..**********.***..*.**.********.**.******.******..****.*.***.**************..**.*.****.***.**********...
output:
574900414
result:
ok single line: '574900414'