QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325270 | #5615. Two Charts Become One | aggrovector# | WA | 23ms | 52792kb | C++14 | 1.1kb | 2024-02-11 06:56:43 | 2024-02-11 06:56:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p64;
typedef vector<ll> v64;
typedef vector<v64> vv64;
typedef vector<p64> vp64;
unordered_set<ll> depts;
v64 tree1[1000005];
v64 tree2[1000005];
v64 *tree;
string str;
stringstream ss;
ll dfs() {
ll dept;
ss >> dept;
depts.insert(dept);
// cout << dept << endl;
v64 children;
char c;
while (ss >> c) {
// cout << c << endl;
if (c == '(') {
children.push_back(dfs());
} else if (c == ')') {
break;
} else {
assert(false);
}
}
sort(children.begin(), children.end());
tree[dept] = children;
return dept;
}
int main() {
getline(cin, str);
ss = stringstream(str);
tree = tree1;
tree[0].push_back(dfs());
getline(cin, str);
ss = stringstream(str);
tree = tree2;
tree[0].push_back(dfs());
for (ll dept : depts) {
if (tree1[dept] != tree2[dept]) {
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 50612kb
input:
11 (10) (12 (13) (17) (28)) 11 (12 (17) (28) (13)) (10)
output:
Yes
result:
ok single line: 'Yes'
Test #2:
score: 0
Accepted
time: 0ms
memory: 50380kb
input:
11 ( 10 ) ( 12 ) 11(10(12))
output:
No
result:
ok single line: 'No'
Test #3:
score: 0
Accepted
time: 0ms
memory: 50400kb
input:
11 (10) (12) 11 (10) (13)
output:
No
result:
ok single line: 'No'
Test #4:
score: 0
Accepted
time: 23ms
memory: 52792kb
input:
289384 (694459 (751708 (887544 (519034 (207488 (373389 ) (912072 ) (191461 ) (91909 ) (5562 ) (705802 ) (469815 ) (726477 ) ) (204098 (530445 ) (655063 ) (156343 ) (980456 ) (186944 ) (198850 ) ) ) (502461 (427161 (615081 ) (801892 ) (594639 ) (786804 ) (811554 ) (810699 ) (935475 ) (717636 ) ) (537...
output:
No
result:
ok single line: 'No'
Test #5:
score: 0
Accepted
time: 18ms
memory: 51292kb
input:
289384 (694459 (751708 (887544 (519034 (207488 (373389 (912072 (191461 (91909 ) (5562 ) ) (705802 (469815 ) (726477 ) (204098 ) (530445 ) (655063 ) ) ) (156343 (980456 (186944 ) (198850 ) ) (502461 (427161 ) (615081 ) (801892 ) (594639 ) (786804 ) ) (811554 (810699 ) (935475 ) (717636 ) (537132 ) ) ...
output:
Yes
result:
ok single line: 'Yes'
Test #6:
score: 0
Accepted
time: 14ms
memory: 51228kb
input:
289384 (694459 (751708 (887544 (519034 (207488 (373389 (912072 (191461 (91909 ) (5562 ) ) (705802 (469815 ) (726477 ) (204098 ) (530445 ) (655063 ) ) ) (156343 (980456 (186944 ) (198850 ) ) (502461 (427161 ) (615081 ) (801892 ) (594639 ) (786804 ) ) (811554 (810699 ) (935475 ) (717636 ) (537132 ) ) ...
output:
No
result:
ok single line: 'No'
Test #7:
score: 0
Accepted
time: 9ms
memory: 51220kb
input:
289384 (694459 (751708 (887544 (519034 (207488 (373389 (912072 (191461 (91909 (5562 ) ) (705802 (469815 ) (726477 ) ) (204098 (530445 ) (655063 ) (156343 ) (980456 ) ) ) (186944 (198850 (502461 ) (427161 ) ) (615081 (801892 ) ) (594639 (786804 ) (811554 ) (810699 ) ) ) (935475 (717636 (537132 ) (678...
output:
Yes
result:
ok single line: 'Yes'
Test #8:
score: 0
Accepted
time: 7ms
memory: 51308kb
input:
289384 (694459 (751708 (887544 (519034 (207488 (373389 (912072 (191461 (91909 (5562 ) ) (705802 (469815 ) (726477 ) ) (204098 (530445 ) (655063 ) (156343 ) (980456 ) ) ) (186944 (198850 (502461 ) (427161 ) ) (615081 (801892 ) ) (594639 (786804 ) (811554 ) (810699 ) ) ) (935475 (717636 (537132 ) (678...
output:
No
result:
ok single line: 'No'
Test #9:
score: 0
Accepted
time: 8ms
memory: 51468kb
input:
289384 (694459 (751708 (887544 (519034 (207488 (373389 (912072 (191461 (91909 (5562 (705802 (469815 (726477 (204098 (530445 (655063 (156343 (980456 (186944 (198850 ) ) ) (502461 (427161 (615081 ) (801892 ) ) (594639 (786804 ) ) ) ) ) ) (811554 (810699 (935475 (717636 (537132 (678641 ) (777412 ) ) (6...
output:
Yes
result:
ok single line: 'Yes'
Test #10:
score: 0
Accepted
time: 8ms
memory: 51332kb
input:
289384 (694459 (751708 (887544 (519034 (207488 (373389 (912072 (191461 (91909 (5562 (705802 (469815 (726477 (204098 (530445 (655063 (156343 (980456 (186944 (198850 ) ) ) (502461 (427161 (615081 ) (801892 ) ) (594639 (786804 ) ) ) ) ) ) (811554 (810699 (935475 (717636 (537132 (678641 ) (777412 ) ) (6...
output:
No
result:
ok single line: 'No'
Test #11:
score: 0
Accepted
time: 3ms
memory: 50396kb
input:
10 10
output:
Yes
result:
ok single line: 'Yes'
Test #12:
score: -100
Wrong Answer
time: 7ms
memory: 50344kb
input:
10 1
output:
Yes
result:
wrong answer 1st lines differ - expected: 'No', found: 'Yes'