QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#325256#5615. Two Charts Become Onejhtang2WA 15ms97036kbC++14562b2024-02-11 06:42:462024-02-11 06:42:47

Judging History

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

  • [2024-02-11 06:42:47]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:97036kb
  • [2024-02-11 06:42:46]
  • 提交

answer

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

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

#define MAX 1000001

vector<set<int>> solve() {
	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 h;
}

int main() {
	cout << (solve() == solve() ? "YES" : "NO");
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 15ms
memory: 97036kb

input:

11 (10) (12 (13) (17) (28))
11 (12 (17) (28) (13)) (10)

output:

YES

result:

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