QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#591914#2827. Autobiographylonelywolf#WA 0ms3844kbC++20728b2024-09-26 19:03:582024-09-26 19:03:59

Judging History

你现在查看的是最新测评结果

  • [2024-09-26 19:03:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3844kb
  • [2024-09-26 19:03:58]
  • 提交

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: ''