Submission #1354606
Source Code Expand
#include <bits/stdc++.h> using namespace std; char s[200010]; stack<int> st; int main(){ scanf("%s", s); for(int i = 0; s[i]; i++){ if(s[i] == 'S'){ st.push(1); } else{ if(st.empty() || st.top() != 1) st.push(0); else st.pop(); } } printf("%d\n", st.size()); }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | kdh9949 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 295 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 1280 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:16:26: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::stack<int>::size_type {aka long unsigned int}’ [-Wformat=] printf("%d\n", st.size()); ^ ./Main.cpp:8:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", s); ^
Judge Result
Set Name | Sample | Subtask1 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 100 / 100 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | example0, example1, example2 |
Subtask1 | example0, example1, example2, sub_corner0, sub_corner1, sub_corner2, sub_rand0, handmade0, handmade1 |
All | corner0, corner1, corner2, example0, example1, example2, handmade0, handmade1, maxrand0, sub_corner0, sub_corner1, sub_corner2, sub_rand0 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
corner0 | AC | 3 ms | 896 KB |
corner1 | AC | 3 ms | 1280 KB |
corner2 | AC | 3 ms | 512 KB |
example0 | AC | 1 ms | 256 KB |
example1 | AC | 1 ms | 256 KB |
example2 | AC | 1 ms | 256 KB |
handmade0 | AC | 1 ms | 256 KB |
handmade1 | AC | 1 ms | 256 KB |
maxrand0 | AC | 3 ms | 384 KB |
sub_corner0 | AC | 1 ms | 256 KB |
sub_corner1 | AC | 1 ms | 256 KB |
sub_corner2 | AC | 1 ms | 256 KB |
sub_rand0 | AC | 1 ms | 256 KB |