QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325149 | #5615. Two Charts Become One | weilaifuture# | WA | 15ms | 52812kb | C++14 | 1.3kb | 2024-02-11 05:01:56 | 2024-02-11 05:01:57 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 1000005;
int tp,x,st[N];
string s1,s2;
vector<int> e1[N],e2[N];
int main(){
getline(cin,s1); getline(cin,s2); s1 = "(" + s1 + ")"; s2 = "(" + s2 + ")";
for(char nw: s1){
if(nw<='9'&&nw>='0'){x=x*10+nw-'0'; continue;}
if(x) e1[st[tp]].push_back(x),st[++tp] = x, x=0;
if(nw==')') tp--;
}
tp=0; st[tp]=0;
for(char nw: s2){
if(nw<='9'&&nw>='0'){x=x*10+nw-'0'; continue;}
if(x) e2[st[tp]].push_back(x),st[++tp] = x, x=0;
if(nw==')') tp--;
}
// for(int i=1;i<=100000;i++){
// if(e1[i].size()==0) continue; sort(e1[i].begin(), e1[i].end());
// cout<<i<<": "; for(int j=0;j<e1[i].size();j++) cout<<e1[i][j]<<" "; cout<<endl;
// }
// for(int i=1;i<=100000;i++){
// if(e2[i].size()==0) continue; sort(e2[i].begin(), e2[i].end());
// cout<<i<<": "; for(int j=0;j<e2[i].size();j++) cout<<e2[i][j]<<" "; cout<<endl;
// }
for(int i=1;i<=1000000;i++){
if(e1[i].size()!=e2[i].size()){cout<<"No"; return 0;}
sort(e1[i].begin(), e1[i].end()); sort(e2[i].begin(), e2[i].end());
for(int j=0;j<e1[i].size();j++) if(e1[i][j]!=e2[i][j]){cout<<"No"; return 0;}
}
cout<<"Yes";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 7ms
memory: 52156kb
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: 3ms
memory: 52404kb
input:
11 ( 10 ) ( 12 ) 11(10(12))
output:
No
result:
ok single line: 'No'
Test #3:
score: 0
Accepted
time: 3ms
memory: 51652kb
input:
11 (10) (12) 11 (10) (13)
output:
No
result:
ok single line: 'No'
Test #4:
score: 0
Accepted
time: 15ms
memory: 52812kb
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: 13ms
memory: 52064kb
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: 15ms
memory: 52320kb
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: 13ms
memory: 52152kb
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: 10ms
memory: 52144kb
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: 13ms
memory: 51488kb
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: 52312kb
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: 10ms
memory: 51724kb
input:
10 10
output:
Yes
result:
ok single line: 'Yes'
Test #12:
score: -100
Wrong Answer
time: 13ms
memory: 51048kb
input:
10 1
output:
Yes
result:
wrong answer 1st lines differ - expected: 'No', found: 'Yes'