QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#325168#5615. Two Charts Become Oneweilaifuture#WA 15ms52928kbC++141.5kb2024-02-11 05:23:562024-02-11 05:23:57

Judging History

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

  • [2024-02-11 05:23:57]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:52928kb
  • [2024-02-11 05:23:56]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 1000005;
int tp,x,st[N],opp;
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(nw=='('){opp++; continue;}
        if(x && opp) e1[st[tp]].push_back(x),st[++tp] = x, x=0, opp--;
        else if(x) st[++tp] = x, e1[x].push_back(0), x=0;
        if(nw==')') tp--;
    }
    tp=0; st[tp]=0; x=0;
    for(char nw: s2){
        if(nw<='9'&&nw>='0'){x=x*10+nw-'0'; continue;}
        if(nw=='('){opp++; continue;}
        if(x && opp) e2[st[tp]].push_back(x),st[++tp] = x, x=0, opp--;
        else if(x) st[++tp] = x, e2[x].push_back(0), 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: 4ms
memory: 51316kb

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

input:

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

output:

No

result:

ok single line: 'No'

Test #3:

score: 0
Accepted
time: 7ms
memory: 52120kb

input:

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

output:

No

result:

ok single line: 'No'

Test #4:

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

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

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

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

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

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

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

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

input:

10
10

output:

Yes

result:

ok single line: 'Yes'

Test #12:

score: -100
Wrong Answer
time: 8ms
memory: 50896kb

input:

10
1

output:

Yes

result:

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