Submission #905396
Source Code Expand
#include<bits/stdc++.h> using namespace std; typedef struct lnod { char c; lnod *left, *right; }*nod; int rs, i; string s; nod root, last; int main() { ios_base::sync_with_stdio(0); cin >> s; for(i = 0; i < (int)s.size(); ++i) { nod p = new lnod; p->c = s[i]; if(!root) { root = p; root->left = NULL; root->right = NULL; last = root; } p->left = last; p->right = NULL; last->right = p; last = p; } for(nod p = root; p->right;) { if(p->c == 'S' && p->right->c == 'T') { if(p == root) { root = p->right->right; p = root; if(!p) break; continue; } nod now = p->left; p->left->right = p->right->right; p = now; continue; } p = p->right; } for(nod p = root; p; p = p->right) ++rs; cout << rs << '\n'; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | Djok |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 934 Byte |
Status | WA |
Exec Time | 16 ms |
Memory | 6804 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 | WA | 15 ms | 6676 KB |
corner1 | WA | 15 ms | 6676 KB |
corner2 | WA | 15 ms | 6676 KB |
example0 | AC | 3 ms | 256 KB |
example1 | AC | 3 ms | 256 KB |
example2 | AC | 3 ms | 256 KB |
handmade0 | AC | 3 ms | 256 KB |
handmade1 | AC | 3 ms | 256 KB |
maxrand0 | WA | 16 ms | 6804 KB |
sub_corner0 | WA | 3 ms | 256 KB |
sub_corner1 | AC | 3 ms | 256 KB |
sub_corner2 | WA | 3 ms | 256 KB |
sub_rand0 | WA | 3 ms | 256 KB |