|
|
back to board0.109s answer Posted by dula 24 Apr 2013 23:50 #include<iostream> #include<string.h> #include<deque> #include<stdio.h> using namespace std; int main() { string node; cin >> node; int one,two; one = 0; two = 1; int pre = 0; for(int i = 0;i < node.size();i++) { if(node[i] == '!') continue; if(node[i] == node[i+1]) { node[i] = node[i+1] = '!'; one = pre; if(i+2 < node.size()) two = i+2; while(one> 0 && two < node.size()) { while(one > 0 && node[one] == '!') one--; if(node[one] == node[two] ) { node[one] = node[two] = '!'; one--;two++; } else break; } } else pre = i; }
for(int i = 0;i < node.size();i++) { if(node[i] != '!') cout << node[i]; }
} Re: 0.109s answer Posted by BillSu 26 Apr 2014 15:15 Good codes Re: 0.109s answer I use stack and my solution works 0.064s :) Re: 0.109s answer Posted by ELDVN 8 Nov 2015 01:41 My solution works 0.048s ;) Re: 0.109s answer Posted by INSOOP 11 Mar 2019 01:06 Why your solutions is right? if input is: sddssdds then your ans is "ss"! Re: 0.109s answer 0.015, guys |
|
|