abdukodir's blog

By abdukodir, 12 years ago, translation, In English

Remind you that round will start in half an hour. The first thousand passes on. Link U can discuss tasks here after the end of the round, Good Luck!

  • Vote: I like it
  • +36
  • Vote: I do not like it

»
12 years ago, # |
  Vote: I like it +23 Vote: I do not like it

World chart showing 1000 * #Remaining / #Qualification_round taken from Google CodeJam statistics page.

Chart with #Remaining only (colors are not the best)

»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone tell me whats wrong with my code for problem A which passes the small input, but not the large one? My idea is, that I count for every position the number of substring which could end at this position and sum them all up in the end...

bool isVowel(char c){
  string vowels="aeiou";
  return vowels.find(c)!=std::string::npos;
}

long long solve(string& s, int n){
  int cons=!isVowel(s[0]) ? 1 :0;
  int m=s.size();
  vector<int> v(m);
  v[0]=n==1 && !isVowel(s[0]) ? 1 :0;
  for(int i=1;i<m;i++){
    cons=!isVowel(s[i]) ? cons+1 : 0;
    v[i] = cons>=n ? i-n+2 : v[i-1];
  }
  return accumulate(v.begin(),v.end(),0);
}

int main() 
{
  int T,n;
  string L;
  cin >> T;
  for(int i=1;i<=T;i++){   
    cin >> L >> n;
    cout << "Case #" << i << ": " << solve(L,n) <<  endl;
  }

}
»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

why the analysis for 1B round hasn't been published yet?