| Show all threads Hide all threads Show all messages Hide all messages |
| Hints for WA15 | Ade | 1133. Fibonacci Sequence | 13 Mar 2017 20:16 | 1 |
46 1836311903 -46 -1836311903 45 |
| It seems that TL is ridiculously strict. | MVM | 2039. Striped Square | 13 Mar 2017 19:12 | 3 |
Is it because O(nm log (n + m)) solutions are not supposed to pass or something like that? My solution has relatively high constant, but O(nm(n + m)) or O(nm log^2 (n + m)) solutions probably won't pass even if TL was bigger, I think. Edited by author 29.03.2015 20:20 usigned int +hash get Accept |
| why so many numbers we need ? | Serizna | 1001. Reverse Root | 13 Mar 2017 12:34 | 3 |
1000000 elements - acceptet but 100000 - not I dont understand stream on 256 KB - is for 64-bit numbers maximum 32768 elements Have you seen sample? Have you seen any 64-bit binary input? Input is text. 256Kb is size of input text. The least possible size of number _in_text_form_ is 2 bytes: "1 ". So max input size in numbers is 256K/2 = 128K numbers. |
| what is the answer on ..? 15757 or 16364? thanks! | esbybb | 2072. Kirill the Gardener 3 | 12 Mar 2017 14:58 | 4 |
1000 13 0 10 14 12 14 9 12 1 0 9 9 16 14 14 10 9 0 9 14 14 14 14 13 13 15 10 14 14 13 14 0 14 9 13 0 7 15 13 9 1 1 0 14 9 10 10 10 14 0 14 12 10 14 0 14 1 13 11 6 10 0 9 0 12 4 9 9 4 6 10 14 4 7 7 14 15 13 13 14 14 12 1 14 6 14 14 16 4 14 16 0 0 16 7 10 12 10 12 14 7 10 14 14 7 10 14 14 13 9 9 0 13 14 15 9 9 9 14 10 1 9 0 14 9 9 10 16 10 9 14 13 13 12 0 14 4 14 9 7 13 13 13 10 9 14 0 13 12 11 4 14 1 4 0 1 9 14 14 14 10 10 0 10 14 0 12 10 0 16 16 15 9 6 0 16 14 1 14 0 9 16 7 14 10 10 16 8 10 13 14 10 14 7 13 7 14 16 4 12 9 14 14 14 1 9 14 15 10 0 13 13 14 7 14 14 16 9 10 12 12 13 9 16 7 16 9 13 7 13 0 14 9 14 12 0 10 0 9 7 9 12 0 14 9 14 16 16 16 10 13 1 0 13 13 16 14 0 14 10 10 13 0 14 14 10 7 14 0 5 13 16 14 12 10 1 1 14 14 13 14 0 13 14 16 0 9 10 10 14 10 13 14 7 0 9 14 7 16 7 6 1 9 7 14 14 1 15 11 9 16 0 14 12 14 9 9 7 14 12 0 7 10 0 14 12 14 1 9 14 10 14 14 9 13 0 14 1 0 9 12 14 14 14 0 13 13 16 15 9 0 14 7 7 0 13 14 14 9 8 14 14 10 14 10 10 13 10 4 4 12 16 12 14 14 11 4 7 12 14 4 0 14 10 16 14 7 7 8 13 16 7 9 1 1 13 8 13 9 0 16 10 1 10 7 15 13 14 14 14 10 1 9 14 14 4 14 16 1 14 8 16 9 14 13 14 0 14 7 14 9 15 10 10 13 14 9 9 0 16 13 13 1 16 7 1 14 7 14 10 0 14 13 15 9 13 10 12 14 10 16 13 14 14 13 10 16 16 14 14 14 14 10 0 13 10 4 14 7 13 9 16 11 13 0 4 10 15 14 14 0 0 13 0 14 14 14 13 16 0 1 13 14 0 9 16 0 16 10 16 9 0 0 13 0 7 16 14 8 13 16 14 13 0 14 9 16 9 13 14 14 14 14 0 9 7 10 0 12 13 16 9 9 14 13 14 1 14 13 14 12 0 13 7 15 15 9 14 12 0 10 13 14 4 16 14 14 12 14 0 9 12 9 14 7 10 1 1 13 10 0 14 9 15 16 15 16 14 12 14 0 12 14 1 12 12 14 0 5 14 14 12 14 16 16 1 6 14 13 8 10 10 13 16 10 14 16 13 1 12 10 14 13 16 10 13 15 7 13 12 0 4 14 1 0 0 16 14 7 9 9 10 16 13 3 4 9 12 7 13 9 12 4 14 15 10 14 7 14 1 14 14 16 12 13 0 0 14 16 14 14 10 8 14 13 14 13 14 0 7 10 0 10 14 10 12 16 16 13 7 12 10 14 14 14 9 7 10 7 13 13 12 14 9 14 12 16 6 7 14 9 14 13 10 0 16 0 14 14 10 15 6 9 14 10 9 10 10 1 14 15 10 14 14 14 1 14 14 14 14 16 15 16 14 6 9 14 13 10 10 12 9 14 16 10 12 16 0 10 14 16 10 14 0 0 7 8 0 13 16 10 14 14 7 0 0 11 15 15 14 13 10 16 12 16 15 16 14 13 4 13 14 14 5 7 0 11 0 13 16 1 13 16 14 14 16 16 16 0 14 10 14 6 14 16 14 13 14 14 16 13 9 14 14 1 9 16 14 12 14 13 14 15 7 14 8 14 13 9 14 7 0 13 1 15 16 0 10 13 14 12 14 14 0 10 7 13 13 13 8 14 9 10 16 7 8 14 14 16 13 7 16 7 9 13 16 14 14 12 0 13 13 9 9 8 15 14 14 14 13 14 13 13 16 14 0 14 16 13 14 8 1 1 1 9 14 9 16 10 14 14 8 0 0 9 6 13 9 0 7 15 8 9 0 14 0 14 14 9 14 12 13 16 14 3 10 14 10 14 11 1 14 14 9 9 9 0 16 0 7 0 16 14 9 14 9 13 14 16 0 0 9 16 14 14 14 10 9 14 1 9 9 14 8 11 15 0 14 11 14 14 0 7 0 14 1 9 14 14 14 14 14 8 16 0 10 0 7 8 14 This test is incorrect, because all a[i]>0. |
| To admins | Dmitri Belous | 1013. K-based Numbers. Version 3 | 10 Mar 2017 21:14 | 1 |
Please, add a comma after "digits" in the phrase "an amount of valid K based numbers, containing N digits, modulo M". I decided "modulo M" is related to "K based numbers", but it's related to "an amount". |
| 772kb and still got MLE#10, please help me | quangduytr | 1220. Stacks | 10 Mar 2017 15:41 | 2 |
#include <iostream> using namespace std; struct duy{ long long x; int y; }; int n,x,last[1001]; long long y; duy m[100001]; char s[5]; int main() { cin.tie(NULL); cout.tie(NULL); cin>>n; for(int i=1; i<=n; i++){ cin>>s>>x; if(s[1]=='U'){ cin>>y; m[i].x=y; m[i].y=last[x]; last[x]=i; } else{ cout<<m[last[x]].x; last[x]=m[last[x]].y; } } } By task description, B is an integer (0 ≤ B ≤ 10^9). So "int x", not "long long x". But it shouldn't be enough. Please estimate (or just type from local run) sizeof(duy) and sizeof(m). Then read task memory restriction. Assume that even "empty main()" program spends about 100 Kb (see successful runs of "1000 A+B" problem for your compiler). In this case duy can hold not only one x, but bucket - ~30 values for example. More, 30 bits are required to save B. So it's possible to save 32 values into "int x[30]" array. Edited by author 10.03.2017 15:50 |
| Java | Dmitri Belous | 1471. Distance in the Tree | 10 Mar 2017 00:06 | 1 |
Java Dmitri Belous 10 Mar 2017 00:06 On Java I reccomend to use ArrayList instead Stack. It saved me about 0.4 sec. Edited by author 10.03.2017 00:06 |
| Что за 4 тест???? | simoncatcity | 2105. Alice and Bob are on Bikes | 9 Mar 2017 14:32 | 1 |
Что за 4 тест??? не могу понять, где что неправильно... |
| RE6 | 💻Evgeny Nemtsev [UrFU FT-17]` | 2109. Tourism on Mars | 9 Mar 2017 06:22 | 2 |
RE6 💻Evgeny Nemtsev [UrFU FT-17]` 7 Mar 2017 14:26 Thank you so much!!!!!!!!!!!!!!!!!!!! Without your kind answer I may never know why I was wrong!! |
| WA Python 3.6 | nnchaos | 1002. Phone Numbers | 9 Mar 2017 02:35 | 2 |
Не понимаю где ошибка. Занимаюсь в целом программированием 3 недели (как хобби) Проверял на исходном примере и на примерах, которые нашел на форуме. Ответы верны. Сюда загружаю выдаёт ошибку. example = {'i' : 1, 'j' : 1, 'a' : 2, 'b' : 2, 'c' : 2, 'd' : 3, 'e' : 3, 'f' : 3, 'g' : 4, 'h' : 4, 'k' : 5, 'l' : 5, 'm' : 6, 'n' : 6, 'p' : 7, 'r' : 7, 's' : 7, 't' : 8, 'u' : 8, 'v' : 8, 'w' : 9, 'x' : 9, 'y' : 9, 'o' : 0, 'q' : 0, 'z' : 0} while True: number = input() if int(number) == -1: break num_words = int(input()) words = {} k = 500 for i in range(num_words): word = input() if len(word) < k: k = len(word) key_word = "" for a in word: key_word += str(example.get(a)) words[int(key_word)] = word answer = [] loser = "" while True: copy = number[len("".join(answer)):] x = len(copy) while x >= k: if int(copy[:x]) in words.keys(): if words[int(copy[:x])] != loser: answer.append(words[int(copy[:x])]) copy = copy[x:] x = len(copy) + 1 x -= 1 if len(answer) == 0: break elif len("".join(answer)) != len(number): loser = answer.pop() elif len("".join(answer)) == len(number): break if len(answer) == 0: print("No solution.") else: ans = " ".join(answer) print(ans) 12345 5 iad i adgk g k -1 should print "i adgk" instead of "iad g k" |
| почему Console.In | AndreyMakuhin | 1001. Reverse Root | 8 Mar 2017 03:59 | 2 |
Ребята, если не сложно, подскажите, почему здесь используем именно Console.In.ReadToEnd() вместо привычного Console.ReadLine() ? Edited by author 26.01.2017 19:15 there can be several numbers in each line. that's why we fistly have to read all the input data and then parse it |
| What's wrong? WA1 | Dmitry_Terenichev | 1001. Reverse Root | 8 Mar 2017 03:49 | 2 |
Edited by author 04.03.2017 21:51 |
| Why WA #3 | Harry | 2000. Grand Theft Array V | 7 Mar 2017 15:13 | 4 |
Plesae! Give me some tests for check my program. So what is the answer ? Is it 45 0 ? Yes, it should be "45 0". |
| C++, What`s wrong with this code ? Test 3 fail. | Ilya | 2109. Tourism on Mars | 7 Mar 2017 11:28 | 4 |
#include<iostream> using namespace std; int main() { int CityCount, RoutesCount; cin >> CityCount; int *Road = new int[(CityCount - 1)*2]; //Roads for (int i = 0; i < (CityCount - 1)*2; i++) { cin >> Road[i]; }
cin >> RoutesCount; int *Route = new int[RoutesCount*2]; //Routes for (int i = 0; i < RoutesCount*2; i++) { cin >> Route[i]; } //Road Matrix int j = 0; int **RMatrix= new int*[CityCount]; for (int i = 0; i < CityCount; i++) { int *LineofMatrix = new int[CityCount]; for (int i = 0; i < (CityCount - 1) * 2; i += 2) { if (Road[i] == j + 1) LineofMatrix[Road[i + 1] - 1] = 1; if (Road[i + 1] == j + 1) LineofMatrix[Road[i] - 1] = 1; } j++; RMatrix[i] = LineofMatrix; } //Output Road Matrix /* cout << endl; for (int i = 0; i < CityCount; i++) { for (int j = 0; j < CityCount; j++) if (RMatrix[i][j]>0) cout << RMatrix[i][j] << ' '; else { RMatrix[i][j] = 0; cout << 0 << ' '; } cout << endl; } cout << endl; */ // alghoritm int *Value = new int[CityCount]; int Vl = 0; int *Locked = new int[CityCount]; int Lock = 0; bool BLock = false; int Bu = 0; int Final; int Cur; int PreCur=-1; int Iter=0; int min = INT_MAX; for (int i = 0; i < RoutesCount * 2; i+=2) { int *Buff = new int[CityCount * 2]; Cur = Route[i] - 1; Final = Route[i + 1] - 1; Buff[Bu++] = Cur; Buff[Bu++] = Final; if (RMatrix[Cur][Final] == 1) { goto fin; } else { for (int j = 0; j < CityCount; j++) { if ((RMatrix[Cur][j] == 1) && (j != PreCur)) { PreCur = Cur; Buff[Bu++] = j; Iter++; Cur = j; j = -1; } if (RMatrix[Cur][Final] == 1) { goto fin; } if (j == CityCount - 1) { j = Cur; Cur = PreCur; Bu -= Iter; Iter = 0; } } } fin: for (int z = 0; z < Bu; z++) { if (min > Buff[z]) { min = Buff[z]; } } Bu = 0; Iter = 0; cout << min+1 << endl; min = INT_MAX; delete[] Buff; }
//system("pause"); return 0; } I fixed mine by changing "writeln(answer)" to "if x = y then writeln(x) else writeln(answer)". (program wasn't working correctly if start and end point were the same) OK, solved this problem but get a RE on test#6. |
| Help me witn test#3!!! | sexygrisha | 1020. Rope | 7 Mar 2017 08:31 | 1 |
Edited by author 08.03.2017 14:32 |
| haha 1.6 s AC ,congratulation to myself>.... | Shen Yang | 1369. Cockroach Race | 6 Mar 2017 22:15 | 4 |
oh yeah, nearly 1000 submits, i dont remember so I get a conclusion: I use veronoi diagram algorithm ,it will have precision error. if you sort coordinates by x, you will get WA on test 17,if you sort it by y,you will get WA on test 21.. so I combine them together, do sort them by x,then sort them by y, and compare the minimum distance, it'll get AC.. so I get a conclusion: I use veronoi diagram algorithm ,it will have precision error. if you sort coordinates by x, you will get WA on test 17,if you sort it by y,you will get WA on test 21.. so I combine them together, do sort them by x,then sort them by y, and compare the minimum distance, it'll get AC.. gz. It is called "lexicographical sorting". |
| В ABC работает, в Free нет. Ошибка компиляции | Dmitry_Terenichev | 1197. Lonesome Knight | 5 Mar 2017 21:25 | 3 |
Edited by author 05.03.2017 21:25 Во фрипаскале кейс не принимает стринги, насколько я помню. Попробуйте через ифы: if (a[i] = 'a1') or (a[i] = 'a8') и тд. |
| C ++ error in test's, but code is correct | polskyLIDER | 1820. Ural Steaks | 5 Mar 2017 13:15 | 1 |
#include "iostream" using namespace std; int main() { int a, b, rz; cin >> a >> b; if (b == 2 && a != 1 || b == 1 && a != 1) { rz = 2 * a / b; } else { if (a % b != 0) { rz = 2 * (a / b + 1); } else { rz = 2 * a / b; } } cout << rz; return 0; } i tested it a lot, pleas help may be i am so silly.... |
| Hello. The problem of very big number. | Андрей | 1761. Binary Palindrome | 5 Mar 2017 01:10 | 2 |
Hello) I can't understand how to work with n = 2^1 000 000, cause it's very big number. I think, this problem can be solved at stage of converting entered number, but don't know exactly how) I understood. The right way is not at converting entered binary number to decimal. |
| Why correct code doesnt work? I get Runtime | SergeyGlazkov [SPbPU] | 2100. Wedding Dinner | 4 Mar 2017 00:23 | 1 |
Problem had tied on the fact that i used tokeniser for numbers and buffered reader for strings, Now i'm using bf reader for both strings and numbers and it gets AC. I leave it here, maybe it will useful Edited by author 05.03.2017 01:23 |