|
|
This can be easily done on python В задачах с условием, на прочтение которых уходит 10 минут (или более) предлагаю писать краткое содержание в форуме! Can somebody give me some tests? I can;t find what's wrong with my prog. Thanks a lot. oh... very stupid error. you should use .clone() in java. now TLE 10 Edited by author 21.02.2010 18:22 10 years have passed) I hope it will help somebody. I had WA3, i forgot to clear vector after set intersection, very stupid mistake Edited by author 24.03.2019 23:54 Edited by author 24.03.2019 23:54 this test helped me: 2 a: fuck it b: fuck this shit 1 a b answer: fuck reason: I indexed the words from 0, but I should from 1 Use unordered map and unordered set. max_load_factor(0.25) reserve (1<<x) I used such variables: map<string,int> id; set<string> list[1003]; map<string,int> mp; vector<string> res; but got TL test 10. Can i get AC with same solution? Yes if instead string use struct{ int num; int row; int poz1; int poz2; }; to have deal with segments of char S[1000][125] to pass test 10 you must do 1) compare hash codes instead of string compare 2) use vectors+sort. In this case vector is way faster than std::set 3) fast I/O. 4) fast list intersection good luck! Words can be easily hashed like: int hash = 0; while(..){ hash = hash * 31 + 'readed byte' } So equals will looks like: @Override public boolean equals(Object o) { return this.hash == o.hashCode(); } On my data program works fine, but got WA. Help me, please :( I can't understand where is trouble in my code Do not make many copies of strings where you can use only pointers on them. what is this - test 13 Edited by author 24.08.2009 15:46 sort. :-) Edited by author 26.08.2009 17:50 Edited by author 26.08.2009 17:51 Почему нет общего ограничения на количество всех вместе взятых ассоциаций, моя прога использует этот факт, как оказалось их даже больще чем 10000!) Придется переписывать( i found my mistake, now AC |
|
|