QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#325259#5615. Two Charts Become Onejhtang2WA 51ms149384kbC++14619b2024-02-11 06:46:222024-02-11 06:46:22

Judging History

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

  • [2024-02-11 06:46:22]
  • 评测
  • 测评结果:WA
  • 用时:51ms
  • 内存:149384kb
  • [2024-02-11 06:46:22]
  • 提交

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);

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

	return {departments, h};
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 47ms
memory: 143960kb

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

input:

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

output:

No

result:

ok single line: 'No'

Test #3:

score: 0
Accepted
time: 20ms
memory: 143844kb

input:

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

output:

No

result:

ok single line: 'No'

Test #4:

score: 0
Accepted
time: 51ms
memory: 149384kb

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

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: 43ms
memory: 145380kb

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: 24ms
memory: 145432kb

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: 43ms
memory: 145516kb

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: 145292kb

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: 32ms
memory: 145348kb

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: 40ms
memory: 143696kb

input:

10
10

output:

Yes

result:

ok single line: 'Yes'

Test #12:

score: -100
Wrong Answer
time: 38ms
memory: 143652kb

input:

10
1

output:

Yes

result:

wrong answer 1st lines differ - expected: 'No', found: 'Yes'