QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#591912 | #2827. Autobiography | lonelywolf# | WA | 0ms | 3824kb | C++20 | 710b | 2024-09-26 19:03:33 | 2024-09-26 19:03:34 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
vector<int> col(n + 1);
for (int i = 1; i <= n; i++) {
char c;
cin >> c;
col[i] = c == 'o' ? 0 : 1;
}
vector cnt(n + 1, vector<int>(2));
vector<pair<int, int>> e(m);
for (int i = 0; i < m; i++) {
int x, y;
cin >> x >> y;
e[i] = {x, y};
if (col[x] != col[y]) {
cnt[x][col[y]]++;
cnt[y][col[x]]++;
}
}
int ans = 0;
for (auto [x, y] : e) {
if (col[x] != col[y]) {
ans += (cnt[x][col[y]] - 1) * (cnt[y][col[x]] - 1);
}
}
cout << ans << "\n";
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3824kb
input:
5 4 bbobo 1 3 2 3 3 4 4 5 4 6 bobo 1 2 1 3 1 4 2 3 2 4 3 4 4 0 bobo
output:
0
result:
wrong answer 1st lines differ - expected: '2', found: '0'