|
|
вернуться в форум0.109s answer Послано dula 24 апр 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 Послано BillSu 26 апр 2014 15:15 Good codes Re: 0.109s answer I use stack and my solution works 0.064s :) Re: 0.109s answer Послано ELDVN 8 ноя 2015 01:41 My solution works 0.048s ;) Re: 0.109s answer Послано INSOOP 11 мар 2019 01:06 Why your solutions is right? if input is: sddssdds then your ans is "ss"! Re: 0.109s answer 0.015, guys |
|
|