ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1654. Cipher Message

WA#1...am out of ideas. HELP
Posted by Tom 9 Aug 2011 02:06
ok...i solved my TLE 6 and TLE 7 problems, now i think it s more than fast enough
but i god WA#1 even though it gives good answers too all tests on my machine....

any ideas what s wrong ? can someone give me test 1 ?


#include<iostream>
#include<vector>

using namespace std;

int main(){

    vector<char> tab;
    char x, previous;
    int size=0,j=0;
    while(!(cin >> x).eof()){
          if(x!=previous){
                   tab.push_back(x);
                   j++;
                   previous=x;
                   }
          else{
               tab.pop_back();
               j--;
               if(j>=1)
               previous = tab[j-1];
               else
               previous = '!';
              }
          }
    for( int i = 0; i < tab.size(); i++ ){
         cout << tab[ i ];
         }
    getchar();getchar();
}

Edited by author 09.08.2011 19:27
Re: WA#1...am out of ideas. HELP
Posted by hatred 10 Aug 2011 04:49
try
abhhcggcffbeedda

answer must be an empty string
Re: WA#1...am out of ideas. HELP
Posted by Tom 10 Aug 2011 14:53
and so it is.
...
any other ideas ?
i really dont know what else to do.
Re: WA#1...am out of ideas. HELP
Posted by GastonFontenla 26 Jul 2015 10:59
You can't do a getchar() when the judge won't write any char! :p