Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
33798 | 申东铉 | 【S】T3 | C++ | 解答错误 | 20 | 4 MS | 696 KB | 850 | 2024-10-22 15:46:23 |
//60 #include <bits/stdc++.h> using namespace std; int n,m; vector <int> e[4003]; vector <char> w[4003]; int u,v; char c; int main () { cin >> n >> m; if (n == m) { int cnt = 0; for (int i = 1;i <= m;i++) { cin >> u >> v >> c; if (c == '(') { cnt++; } } if (cnt * 2 == m) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; } for (int i = 1;i <= m;i++) { cin >> u >> v >> c; e[u].push_back(v); w[u].push_back(c); } int x = -1,y = -1; for (int i = 1;i <= n;i++) { int sz = e[u].size(); for(int j = 0;j < sz;j++) { if (e[u][j] == u && w[u][j] == '(') { x = u; } if (e[u][j] == u && w[u][j] == ')') { y = u; } } } if (x == -1 || y == -1) { cout << "No" << endl; } else { cout << "Yes" << endl; } return 0; }