QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#184870 | #5615. Two Charts Become One | ucup-team004 | AC ✓ | 43ms | 8628kb | C++20 | 1.1kb | 2023-09-21 13:49:02 | 2023-09-21 13:49:03 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
std::map<std::pair<int, std::vector<int>>, int> mp;
int get(int x, const std::vector<int> &ch) {
if (mp.count({x, ch})) {
return mp[{x, ch}];
}
return mp[{x, ch}] = mp.size();
}
int read() {
std::string s;
std::getline(std::cin, s);
s.erase(std::remove(s.begin(), s.end(), ' '), s.end());
int cur = 0;
auto solve = [&](auto self) -> int {
int x = 0;
while (cur < s.size() && std::isdigit(s[cur])) {
x = 10 * x + s[cur] - '0';
cur++;
}
std::vector<int> ch;
while (cur < s.size() && s[cur] == '(') {
cur++;
ch.push_back(self(self));
cur++;
}
std::sort(ch.begin(), ch.end());
return get(x, ch);
};
return solve(solve);
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int x = read();
int y = read();
std::cout << (x == y ? "Yes" : "No") << "\n";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3476kb
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: 1ms
memory: 3476kb
input:
11 ( 10 ) ( 12 ) 11(10(12))
output:
No
result:
ok single line: 'No'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3480kb
input:
11 (10) (12) 11 (10) (13)
output:
No
result:
ok single line: 'No'
Test #4:
score: 0
Accepted
time: 20ms
memory: 6940kb
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: 8ms
memory: 4560kb
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: 7ms
memory: 4560kb
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: 7ms
memory: 4576kb
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: 0ms
memory: 4580kb
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: 6ms
memory: 4604kb
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: 6ms
memory: 4492kb
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: 1ms
memory: 3548kb
input:
10 10
output:
Yes
result:
ok single line: 'Yes'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
10 1
output:
No
result:
ok single line: 'No'
Test #13:
score: 0
Accepted
time: 41ms
memory: 8544kb
input:
289384 (638630 ) (239184 ) (765440 ) (646178 (372606 ) (910028 ) (190096 ) (91605 ) (5527 ) (705508 ) (469479 ) (726199 ) (201953 ) (529344 ) (653748 ) (154974 ) (979397 ) (186316 ) (197719 ) (501602 ) (426553 ) (613347 ) (801743 ) (593510 ) (786392 ) (809643 ) (810562 ) (934493 ) (717125 ) (535195 ...
output:
Yes
result:
ok single line: 'Yes'
Test #14:
score: 0
Accepted
time: 32ms
memory: 8552kb
input:
289384 (638630 ) (239184 ) (765440 ) (646178 (372606 ) (910028 ) (190096 ) (91605 ) (5527 ) (705508 ) (469479 ) (726199 ) (201953 ) (529344 ) (653748 ) (154974 ) (979397 ) (186316 ) (197719 ) (501602 ) (426553 ) (613347 ) (801743 ) (593510 ) (786392 ) (809643 ) (810562 ) (934493 ) (717125 ) (535195 ...
output:
No
result:
ok single line: 'No'
Test #15:
score: 0
Accepted
time: 43ms
memory: 8536kb
input:
289384 (638630 ) (239184 ) (765440 ) (646178 (372606 ) (910028 ) (190096 ) (91605 ) (5527 ) (705508 ) (469479 ) (726199 ) (201953 ) (529344 ) (653748 ) (154974 ) (979397 ) (186316 ) (197719 ) (501602 ) (426553 ) (613347 ) (801743 ) (593510 ) (786392 ) (809643 ) (810562 ) (934493 ) (717125 ) (535195 ...
output:
No
result:
ok single line: 'No'
Test #16:
score: 0
Accepted
time: 37ms
memory: 8628kb
input:
289384 (638630 ) (239184 ) (765440 ) (646178 (372606 ) (910028 ) (190096 ) (91605 ) (5527 ) (705508 ) (469479 ) (726199 ) (201953 ) (529344 ) (653748 ) (154974 ) (979397 ) (186316 ) (197719 ) (501602 ) (426553 ) (613347 ) (801743 ) (593510 ) (786392 ) (809643 ) (810562 ) (934493 ) (717125 ) (535195 ...
output:
No
result:
ok single line: 'No'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3720kb
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 (698714 (656060 (853387 (972741 ...
output:
Yes
result:
ok single line: 'Yes'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
384 (154 (136 (540 ) (298 ) (133 ) (273 ) (948 ) (61 ) ) (823 (792 ) (348 ) (407 ) (972 ) (916 ) (250 ) (439 ) ) (840 (414 ) (491 ) (450 ) (742 ) (963 ) (606 ) (860 ) (639 ) ) (736 (800 ) ) (591 (595 ) ) (146 (345 ) (249 ) (31 ) (914 ) (976 ) (559 ) ) ) (678 (413 (646 ) (848 ) (720 ) (835 ) (718 ) )...
output:
Yes
result:
ok single line: 'Yes'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3488kb
input:
384 (154 (136 (540 ) (298 ) (133 ) (273 ) (948 ) (61 ) ) (823 (792 ) (348 ) (407 ) (972 ) (916 ) (250 ) (439 ) ) (840 (414 ) (491 ) (450 ) (742 ) (963 ) (606 ) (860 ) (639 ) ) (736 (800 ) ) (591 (595 ) ) (146 (345 ) (249 ) (31 ) (914 ) (976 ) (559 ) ) ) (678 (413 (646 ) (848 ) (720 ) (835 ) (718 ) )...
output:
No
result:
ok single line: 'No'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3488kb
input:
384 (154 (136 (540 (298 (133 (273 (948 (61 (823 (792 ) ) ) ) (348 (407 (972 (916 ) (250 ) ) ) (439 (840 (414 ) (491 ) ) ) ) ) (450 (742 (963 (606 (860 ) ) (639 (736 ) ) ) (800 (591 (595 ) ) (146 (345 ) (249 ) ) ) ) (31 (914 (976 (559 ) (678 ) ) (413 (646 ) ) ) (848 (720 (835 ) ) ) ) ) ) (718 (679 (2...
output:
Yes
result:
ok single line: 'Yes'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
384 (154 (136 (540 (298 (133 (273 (948 (61 (823 (792 ) ) ) ) (348 (407 (972 (916 ) (250 ) ) ) (439 (840 (414 ) (491 ) ) ) ) ) (450 (742 (963 (606 (860 ) ) (639 (736 ) ) ) (800 (591 (595 ) ) (146 (345 ) (249 ) ) ) ) (31 (914 (976 (559 ) (678 ) ) (413 (646 ) ) ) (848 (720 (835 ) ) ) ) ) ) (718 (679 (2...
output:
No
result:
ok single line: 'No'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3464kb
input:
384 (707 (136 (540 (298 (133 (273 (948 (61 (823 (792 ) ) ) ) (348 (407 (972 (916 ) (250 ) ) ) (439 (840 (414 ) (491 ) ) ) ) ) (450 (742 (963 (606 (860 ) ) (639 (736 ) ) ) (800 (591 (595 ) ) (146 (345 ) (249 ) ) ) ) (31 (914 (976 (559 ) (678 ) ) (413 (646 ) ) ) (848 (720 (835 ) ) ) ) ) ) (718 (679 (2...
output:
No
result:
ok single line: 'No'
Test #23:
score: 0
Accepted
time: 27ms
memory: 6956kb
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:
Yes
result:
ok single line: 'Yes'