QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#591914 | #2827. Autobiography | lonelywolf# | WA | 0ms | 3844kb | C++20 | 728b | 2024-09-26 19:03:58 | 2024-09-26 19:03:59 |
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;
cin >> 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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3844kb
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:
2
result:
wrong answer 2nd lines differ - expected: '4', found: ''