QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#325261#5615. Two Charts Become Onejhtang2AC ✓117ms159472kbC++14677b2024-02-11 06:47:172024-02-11 06:47:18

Judging History

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

  • [2024-02-11 06:47:18]
  • 评测
  • 测评结果:AC
  • 用时:117ms
  • 内存:159472kb
  • [2024-02-11 06:47:17]
  • 提交

answer

// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

#define MAX 1000001

pair<set<int>, vector<set<int>>> solve() {
	set<int> departments;

	string parse;
	getline(cin, parse);

	istringstream is(parse);
	vector<set<int>> h(MAX);
	stack<int> st;

	int fir;
	is >> fir;
	st.push(fir);
	departments.insert(fir);

	char c;
	while (is >> c) {
		if (c == ')') {
			st.pop();
		}
		if (c == '(') {
			int child;
			is >> child;
			h[st.top()].insert(child);
			st.push(child);
			departments.insert(child);
		}
	}

	return {departments, h};
}

int main() {
	cout << (solve() == solve() ? "Yes" : "No");
}

详细

Test #1:

score: 100
Accepted
time: 24ms
memory: 143996kb

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: 15ms
memory: 143944kb

input:

11 ( 10 ) ( 12 )
11(10(12))

output:

No

result:

ok single line: 'No'

Test #3:

score: 0
Accepted
time: 36ms
memory: 143840kb

input:

11 (10) (12)
11 (10) (13)

output:

No

result:

ok single line: 'No'

Test #4:

score: 0
Accepted
time: 61ms
memory: 154120kb

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: 51ms
memory: 146988kb

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: 45ms
memory: 147112kb

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: 42ms
memory: 146980kb

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: 54ms
memory: 147004kb

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: 48ms
memory: 146364kb

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: 51ms
memory: 146340kb

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: 37ms
memory: 143808kb

input:

10
10

output:

Yes

result:

ok single line: 'Yes'

Test #12:

score: 0
Accepted
time: 35ms
memory: 143948kb

input:

10
1

output:

No

result:

ok single line: 'No'

Test #13:

score: 0
Accepted
time: 117ms
memory: 159472kb

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: 96ms
memory: 159464kb

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: 106ms
memory: 159464kb

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: 99ms
memory: 159448kb

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: 36ms
memory: 144096kb

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: 35ms
memory: 143820kb

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: 20ms
memory: 143840kb

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: 21ms
memory: 143868kb

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: 30ms
memory: 143804kb

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: 39ms
memory: 143896kb

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: 78ms
memory: 153904kb

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'