Submission #2866422
Source Code Expand
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args)throws Exception { InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader (is); String []input = br.readLine().split(""); Main m = new Main(); stack st = m.new stack(); for(String s: input) { st.push(s); if(st.getSize() > 1) { String temp = st.pop()+ st.pop(); if(!"TS".equals(temp)) { st.push(temp.substring(0,1)); st.push(temp.substring(1,2)); } } } System.out.println(st.getSize()); } public class stack{ private ArrayList<String> stackList; private int count; stack(){ stackList = new ArrayList<String>(); count = 0; } public String pop() { String s = stackList.get(count-1); stackList.remove(count-1); count--; return s; } public void push(String s) { stackList.add(s); count++; } public int getSize() { return count; } } }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | unirita107 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1061 Byte |
Status | WA |
Exec Time | 299 ms |
Memory | 68304 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | 0 / 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 | 275 ms | 55212 KB |
corner1 | WA | 282 ms | 64716 KB |
corner2 | WA | 289 ms | 68052 KB |
example0 | WA | 71 ms | 19284 KB |
example1 | AC | 70 ms | 17748 KB |
example2 | WA | 70 ms | 21204 KB |
handmade0 | AC | 70 ms | 20564 KB |
handmade1 | AC | 70 ms | 18004 KB |
maxrand0 | WA | 299 ms | 68304 KB |
sub_corner0 | AC | 84 ms | 18388 KB |
sub_corner1 | WA | 73 ms | 19284 KB |
sub_corner2 | WA | 74 ms | 18900 KB |
sub_rand0 | WA | 73 ms | 21332 KB |