Submission #63063398
Source Code Expand
Copy
#include<bits/stdc++.h>using namespace std;string s;char n;int m=1;int main(){cin>>s;if(s.length()%2){cout<<"No"<<endl;return 0;}n=s[0];for(int i=1;i<s.length();i++){if(n=='('&&(s[i]=='>'||s[i]==']')){m=0;break;}if(n=='['&&(s[i]=='>'||s[i]==')'))
#include<bits/stdc++.h> using namespace std; string s; char n; int m=1; int main(){ cin>>s; if(s.length()%2) { cout<<"No"<<endl; return 0; } n=s[0]; for(int i=1;i<s.length();i++) { if(n=='('&&(s[i]=='>'||s[i]==']')) { m=0; break; } if(n=='['&&(s[i]=='>'||s[i]==')')) { m=0; break; } if(n=='<'&&(s[i]==']'||s[i]==')')) { m=0; break; } n=s[i]; } cout<<(m?"Yes":"No")<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Colorful Bracket Sequence |
User | yin21g1223 |
Language | C++ 20 (gcc 12.2) |
Score | 0 |
Code Size | 521 Byte |
Status | WA |
Exec Time | 5 ms |
Memory | 3828 KB |
Compile Error
Main.cpp: In function ‘int main()’: Main.cpp:14:16: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 14 | for(int i=1;i<s.length();i++) | ~^~~~~~~~~~~
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example_00.txt, example_01.txt, example_02.txt |
All | example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_00.txt | AC | 1 ms | 3460 KB |
example_01.txt | AC | 1 ms | 3508 KB |
example_02.txt | AC | 1 ms | 3548 KB |
hand_00.txt | AC | 4 ms | 3676 KB |
hand_01.txt | AC | 4 ms | 3700 KB |
hand_02.txt | AC | 3 ms | 3696 KB |
hand_03.txt | WA | 1 ms | 3404 KB |
hand_04.txt | AC | 3 ms | 3768 KB |
hand_05.txt | AC | 1 ms | 3452 KB |
hand_06.txt | AC | 1 ms | 3636 KB |
random_00.txt | AC | 3 ms | 3676 KB |
random_01.txt | AC | 4 ms | 3640 KB |
random_02.txt | AC | 4 ms | 3676 KB |
random_03.txt | WA | 4 ms | 3824 KB |
random_04.txt | WA | 4 ms | 3612 KB |
random_05.txt | AC | 4 ms | 3652 KB |
random_06.txt | WA | 4 ms | 3672 KB |
random_07.txt | WA | 4 ms | 3736 KB |
random_08.txt | WA | 4 ms | 3592 KB |
random_09.txt | AC | 4 ms | 3608 KB |
random_10.txt | AC | 4 ms | 3608 KB |
random_11.txt | AC | 4 ms | 3584 KB |
random_12.txt | AC | 4 ms | 3676 KB |
random_13.txt | WA | 4 ms | 3824 KB |
random_14.txt | AC | 4 ms | 3672 KB |
random_15.txt | AC | 4 ms | 3628 KB |
random_16.txt | WA | 4 ms | 3768 KB |
random_17.txt | AC | 4 ms | 3676 KB |
random_18.txt | AC | 4 ms | 3736 KB |
random_19.txt | AC | 3 ms | 3680 KB |
random_20.txt | AC | 4 ms | 3640 KB |
random_21.txt | AC | 4 ms | 3700 KB |
random_22.txt | AC | 4 ms | 3744 KB |
random_23.txt | AC | 4 ms | 3700 KB |
random_24.txt | AC | 4 ms | 3672 KB |
random_25.txt | WA | 4 ms | 3628 KB |
random_26.txt | AC | 4 ms | 3828 KB |
random_27.txt | AC | 4 ms | 3824 KB |
random_28.txt | AC | 4 ms | 3680 KB |
random_29.txt | WA | 5 ms | 3584 KB |