Submission #63063506


Source Code Expand

Copy
#include<bits/stdc++.h>
#define ll long long
#define ss second
#define ff first
#define pb push_back
#define mod 1000000007
#define endl "\n"
using namespace std;
ll n;
char ch;
string s;
map<char,char> m;
vector<char> v;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>s;
for (int i=0; i<s.size(); i++)
{if (s[i]=='('||s[i]=='['||s[i]=='<') v.push_back(s[i]);
else {if (v[v.size()-1]=='('&&s[i]!=')'||v[v.size()-1]=='<'&&s[i]!='>'||v[v.size()-1]=='['&&s[i]!=']'&&v.size()==0) {cout<<"No"<<endl; exit(0);} v.pop_back();}
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
#define ll long long
#define ss second
#define ff first
#define pb push_back
#define mod 1000000007
#define endl "\n"
using namespace std;
ll n;
char ch;
string s;
map<char,char> m;
vector<char> v;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>s;
	for (int i=0; i<s.size(); i++)
    {if (s[i]=='('||s[i]=='['||s[i]=='<') v.push_back(s[i]);
    else {if (v[v.size()-1]=='('&&s[i]!=')'||v[v.size()-1]=='<'&&s[i]!='>'||v[v.size()-1]=='['&&s[i]!=']'&&v.size()==0) {cout<<"No"<<endl; exit(0);} v.pop_back();}
    }
    if (v.size()==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Submission Info

Submission Time
Task D - Colorful Bracket Sequence
User Tegshzaya
Language C++ 20 (gcc 12.2)
Score 0
Code Size 655 Byte
Status RE
Exec Time 76 ms
Memory 3748 KB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:19:24: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   19 |         for (int i=0; i<s.size(); i++)
      |                       ~^~~~~~~~~
Main.cpp:21:33: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
   21 |     else {if (v[v.size()-1]=='('&&s[i]!=')'||v[v.size()-1]=='<'&&s[i]!='>'||v[v.size()-1]=='['&&s[i]!=']'&&v.size()==0) {cout<<"No"<<endl; exit(0);} v.pop_back();}
Main.cpp:21:106: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
   21 |     else {if (v[v.size()-1]=='('&&s[i]!=')'||v[v.size()-1]=='<'&&s[i]!='>'||v[v.size()-1]=='['&&s[i]!=']'&&v.size()==0) {cout<<"No"<<endl; exit(0);} v.pop_back();}

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 38
WA × 1
RE × 1
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 3468 KB
example_01.txt AC 1 ms 3428 KB
example_02.txt AC 1 ms 3464 KB
hand_00.txt AC 2 ms 3612 KB
hand_01.txt AC 2 ms 3548 KB
hand_02.txt AC 2 ms 3604 KB
hand_03.txt RE 76 ms 3072 KB
hand_04.txt AC 2 ms 3608 KB
hand_05.txt AC 1 ms 3472 KB
hand_06.txt AC 1 ms 3480 KB
random_00.txt AC 1 ms 3728 KB
random_01.txt AC 2 ms 3576 KB
random_02.txt AC 2 ms 3560 KB
random_03.txt AC 2 ms 3612 KB
random_04.txt AC 1 ms 3604 KB
random_05.txt AC 2 ms 3616 KB
random_06.txt AC 1 ms 3608 KB
random_07.txt AC 2 ms 3600 KB
random_08.txt AC 1 ms 3480 KB
random_09.txt AC 2 ms 3740 KB
random_10.txt AC 2 ms 3616 KB
random_11.txt AC 2 ms 3604 KB
random_12.txt AC 2 ms 3740 KB
random_13.txt AC 2 ms 3480 KB
random_14.txt AC 2 ms 3476 KB
random_15.txt WA 3 ms 3696 KB
random_16.txt AC 2 ms 3668 KB
random_17.txt AC 1 ms 3580 KB
random_18.txt AC 2 ms 3604 KB
random_19.txt AC 2 ms 3544 KB
random_20.txt AC 3 ms 3748 KB
random_21.txt AC 3 ms 3600 KB
random_22.txt AC 2 ms 3540 KB
random_23.txt AC 3 ms 3576 KB
random_24.txt AC 3 ms 3592 KB
random_25.txt AC 1 ms 3616 KB
random_26.txt AC 3 ms 3568 KB
random_27.txt AC 3 ms 3608 KB
random_28.txt AC 3 ms 3604 KB
random_29.txt AC 2 ms 3580 KB


2025-03-25 (Tue)
01:07:14 +00:00