QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#325148#5615. Two Charts Become Oneweilaifuture#WA 15ms52448kbC++141.3kb2024-02-11 05:01:072024-02-11 05:01:08

Judging History

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

  • [2024-02-11 05:01:08]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:52448kb
  • [2024-02-11 05:01:07]
  • 提交

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--;
    }
    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: 11ms
memory: 50972kb

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

input:

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

output:

No

result:

ok single line: 'No'

Test #3:

score: 0
Accepted
time: 15ms
memory: 51748kb

input:

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

output:

No

result:

ok single line: 'No'

Test #4:

score: 0
Accepted
time: 11ms
memory: 52228kb

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

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: 11ms
memory: 51548kb

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

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

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: 8ms
memory: 51788kb

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: 10ms
memory: 52384kb

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: 4ms
memory: 52236kb

input:

10
10

output:

Yes

result:

ok single line: 'Yes'

Test #12:

score: -100
Wrong Answer
time: 9ms
memory: 51176kb

input:

10
1

output:

Yes

result:

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