Submission #63041069
Source Code Expand
Copy
#include <bits/stdc++.h>using namespace std;#define endl '\n'#define TRACE 1#define tcout TRACE && cout#define int long long#define fst ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);#define pri priority_queueconst int P = 998244353;const int INF = 0x3f3f3f3f3f3f3f3f;const int N = 1e5+10, M = 1e8 + 10;string s;
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define TRACE 1 #define tcout TRACE && cout #define int long long #define fst ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define pri priority_queue const int P = 998244353; const int INF = 0x3f3f3f3f3f3f3f3f; const int N = 1e5+10, M = 1e8 + 10; string s; bool f(string&s){ stack<char>stk; for(char c:s){ if(c=='('||c=='['||c=='<'){ stk.push(c); } else{ if(stk.empty())return false; char top=stk.top(); if((c==')'&&top=='(')||(c==']'&&top=='[')||(c=='>'&&top=='<')){ stk.pop(); } else{ return false; } } } return stk.empty(); } signed main(){ cin>>s; if(f(s)){ cout<<"Yes"; } else{ cout<<"No"; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Colorful Bracket Sequence |
User | ToT_and_QwQ |
Language | C++ 20 (gcc 12.2) |
Score | 400 |
Code Size | 925 Byte |
Status | AC |
Exec Time | 5 ms |
Memory | 3804 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 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 | 3484 KB |
example_01.txt | AC | 1 ms | 3480 KB |
example_02.txt | AC | 1 ms | 3556 KB |
hand_00.txt | AC | 4 ms | 3604 KB |
hand_01.txt | AC | 4 ms | 3668 KB |
hand_02.txt | AC | 4 ms | 3612 KB |
hand_03.txt | AC | 1 ms | 3612 KB |
hand_04.txt | AC | 4 ms | 3544 KB |
hand_05.txt | AC | 1 ms | 3452 KB |
hand_06.txt | AC | 1 ms | 3488 KB |
random_00.txt | AC | 3 ms | 3680 KB |
random_01.txt | AC | 4 ms | 3604 KB |
random_02.txt | AC | 4 ms | 3604 KB |
random_03.txt | AC | 4 ms | 3616 KB |
random_04.txt | AC | 3 ms | 3668 KB |
random_05.txt | AC | 4 ms | 3608 KB |
random_06.txt | AC | 3 ms | 3604 KB |
random_07.txt | AC | 3 ms | 3672 KB |
random_08.txt | AC | 3 ms | 3676 KB |
random_09.txt | AC | 4 ms | 3612 KB |
random_10.txt | AC | 4 ms | 3760 KB |
random_11.txt | AC | 4 ms | 3676 KB |
random_12.txt | AC | 4 ms | 3616 KB |
random_13.txt | AC | 3 ms | 3668 KB |
random_14.txt | AC | 4 ms | 3684 KB |
random_15.txt | AC | 4 ms | 3576 KB |
random_16.txt | AC | 4 ms | 3604 KB |
random_17.txt | AC | 3 ms | 3548 KB |
random_18.txt | AC | 4 ms | 3740 KB |
random_19.txt | AC | 3 ms | 3604 KB |
random_20.txt | AC | 4 ms | 3552 KB |
random_21.txt | AC | 4 ms | 3616 KB |
random_22.txt | AC | 4 ms | 3676 KB |
random_23.txt | AC | 5 ms | 3676 KB |
random_24.txt | AC | 4 ms | 3664 KB |
random_25.txt | AC | 3 ms | 3740 KB |
random_26.txt | AC | 4 ms | 3804 KB |
random_27.txt | AC | 4 ms | 3604 KB |
random_28.txt | AC | 4 ms | 3680 KB |
random_29.txt | AC | 4 ms | 3576 KB |