QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325134 | #5615. Two Charts Become One | weilaifuture# | RE | 2ms | 8380kb | C++14 | 1.2kb | 2024-02-11 04:43:04 | 2024-02-11 04:43:05 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int tp,x,st[N];
string s1,s2;
vector<int> e1[N],e2[N];
int main(){
getline(cin,s1); getline(cin,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<=100000;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: 0ms
memory: 8280kb
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: 0ms
memory: 8380kb
input:
11 ( 10 ) ( 12 ) 11(10(12))
output:
No
result:
ok single line: 'No'
Test #3:
score: 0
Accepted
time: 2ms
memory: 8288kb
input:
11 (10) (12) 11 (10) (13)
output:
No
result:
ok single line: 'No'
Test #4:
score: -100
Runtime Error
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...