Common Board| Show all threads Hide all threads Show all messages Hide all messages | | WA13 | Carbon | 1558. Periodical Numbers | 22 Sep 2010 02:59 | 2 | WA13 Carbon 12 Jun 2008 15:53 What does this test look like? Re: WA13 Vassenbaher [IU7.BMSTU] 22 Sep 2010 02:59 Probably like this: (49937) (92484) ----------- (24242)1 | | You must create a class big integer for you to solve this problem in C++ | Phan Hoài Nam (HUFLIT) | 1133. Fibonacci Sequence | 21 Sep 2010 22:16 | 2 | You calculate f2 by this formula: f2 = f1 + f0 f2 may be small enough to be stored by an integer, but f1 and f0 may be very large. For example: 1 = (-2935892358923598) + (2935892358923599) Since you know that −2·109 ≤ Fk ≤ 2·109 (k = min(i, j, n), …, max(i, j, n)), the problem is solvable with usual int | | C++ compiler | Senya | | 21 Sep 2010 22:14 | 2 | Hello what's compiler is on the server? where is my typeof() ? | | WA15 | Marginean Ciprian | 1772. Ski-Trails for Robots | 21 Sep 2010 15:44 | 1 | WA15 Marginean Ciprian 21 Sep 2010 15:44 I use sqrt decomposition and some DP. My DP idea is to keep for each robot the shortest path which we can find if we detour by left or right. And I use sqrt decomposition to find the next encountered robot on the current path. Could someone give me a tricky example? Edit: I wrote the update of the sqrt decomposition again(different) and now I get WA23. Edited by author 22.09.2010 15:13 | | Y did I get a WA #2 ? Please help me ! | BingoX | 1078. Segments | 20 Sep 2010 22:27 | 2 | #include <cstdio> #include <cstring> #include <cmath> using namespace std; int a[501][3], f[501], trace[501], n, ans, t; void sort(int l, int r) { int x = a[(l + r) >> 1][0]; int i, j, t[3]; i = l; j = r; do { while (a[i][0] < x) i++; while (a[j][0] > x) j--; if (i <= j) { memcpy(t, a[i], sizeof(t)); memcpy(a[i], a[j], sizeof(t)); memcpy(a[j], t, sizeof(t)); } i++; j--; } while (i <= j); if (i < r) sort(i, r); if (l < j) sort(l, j); } int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d %d", &a[i][0], &a[i][1]); a[i][2] = i; } for (int i = 1; i <= n; i++) f[i] = 1; sort(1, n); for (int i = 2; i <= n; i++) for (int j = 1; j < i; j++) if ((a[j][0] < a[i][0]) && (a[j][1] > a[i][1]) && (f[j] + 1 > f[i])) { f[i] = f[j] + 1; trace[i] = j; } ans = 0; t = 0; for (int i = 1; i <= n; i++) if (f[i] > ans) { ans = f[i]; t = i; }; printf("%d\n", ans); while (t != 0) { printf("%d ", a[t][2]); t = trace[t]; } return 0; } | | why WA at 9th test? | kolobok | 1629. Trip | 20 Sep 2010 15:31 | 2 | I don't know!I also wrong at 9th! | | Помогите понять условие! / Help to understand a condition! | Pustovalov Evgeny [Ekaterinburg SESC USU] | 1083. Factorials!!! | 19 Sep 2010 19:37 | 4 | Читаю который раз, а все понять не могу, что за бред... I read which time, and all I can not understand that for delirium... дак условие же на русском и примеры довольно понятные. Я вижу, что на русском... А примеры не понятные... Все, понял)) Всем спасибо... | | why WA 6??? | junsuper | 1085. Meeting | 18 Sep 2010 20:33 | 3 | I had WA6 when I tried to output the total sum after zero, e.g. when meeting was impossible On test 6 there is a station that is unreachable and that's why the answer is a single zero. For instance this test: 3 1 2 1 2 3 20 1 0 20 2 0 20 3 1 should output 0. | | What about 15 test | rodge(Vologda ML) | 1280. Topological Sorting | 18 Sep 2010 20:30 | 2 | What it can be???i have TL 15 if i change code i have wa 15 it's terrible) Sorry, my problem was in array)Read conditions more attentively, not as I))) | | example is wrong | LeonidR | 1005. Stone Pile | 18 Sep 2010 00:58 | 2 | 5+5+13+14=37 27+8=35 result=2 Read forum before asking questions like this. // the number of stones 5 // their weights 5 8 13 27 14 | | if TLE | Hanzbrow (TNU) KCC | 1654. Cipher Message | 17 Sep 2010 20:15 | 3 | if TLE Hanzbrow (TNU) KCC 10 Jul 2009 21:05 of course you need O(n) and I had it but I was mad about this(TLE), but I thought a little and tried to use char s[200010] and now AC 0.031)))))))))))))) don't use list or string in this problem write your own implementation of std::list good luck) Edited by author 10.07.2009 23:29 Edited by author 10.07.2009 23:49 i use vectors and got AC in 0.046s 557 КБ with 5 lines of code)) std::list<char> simply gives AC in 0.343 sec. | | #1 Test | Pavel Kovalenko | 1711. Code Names | 17 Sep 2010 19:33 | 6 | #1 Test Pavel Kovalenko 10 Oct 2009 15:13 why my answer of the test#1 is incorrect? codenames grille keywords mnemonic playgame random rectangle rejudge shaitan size twosides its correct my program give this answer but i have wa28 and i don't understand why( try this 3 bbb bb b bbb bb b bbb bb b 1 2 3 output b bb bbb first,i get WA28, i get AC28,but WA1,now Edited by author 11.03.2010 13:31 @kecin, I think, that's incorrect test, because "All codenames are different", but my program output: b bb bbb On sample test my prog. works right too, but WA1 :( Edited by author 02.04.2010 19:55 I had WA 1 too, but now I have AC. This test helped me: 2 cipher grille kamkohob ciphez grillz kamkohoz 2 1 Possible answers: ciphez grille or ciphez kamkohob or grillz kamkohob my answer : codenames grille keywords mnemonic playgame random rectangle rejudge shaitan size twosides | | The answer to the problem | [NKU]sweet | 1220. Stacks | 17 Sep 2010 16:49 | 2 | we can easily design 1000 stacks using a linked list,every node we 'll use a int to store its data,another int to store its father's index,we'll use 8 byte each node, about 800K,that will get MLE. Then we can see the index of a node's father will always <=100000,we can just use 17 bit to store it,instead of a int(32 bit),zipped it and get AC~ :) The problem can be solved much easier using only 101000 ints =) And complexity of the algo is about O (N logN) | | Why? Please help me! | kxurshid | 1005. Stone Pile | 17 Sep 2010 13:33 | 1 | Why WA on test1. I think this is rigth. #include <iostream> #include <bitset> using namespace std; int main() { int n,max = 1,summa, temp; int *w; cin >> n; w = new int[n]; for(int i = 0; i < n; i++) { max *= 2; cin >> w[i]; } max -= 2; bitset<20> a; temp = w[0]; while(max >= 1) { a = max; summa = 0; for(int i = 0; i < n; i++) { if(a.at(i)) summa += w[i]; else summa -= w[i]; } if(temp > summa && summa >= 0) temp = summa; max--; } cout << temp; return 0; } | | WA #3. Take pity! Give me this test... | ashim | 1156. Two Rounds | 17 Sep 2010 02:29 | 1 | I tried all tests given here (also in other forum messages) and always get correct answer. I have no idea, what's wrong with this: #include <iostream> #include <cmath> using namespace std; class Task { public: int arrSameTasks[101], lastIndex; bool IsInTour; Task() { IsInTour = false; lastIndex = 0; }
void AddSameTask(int someTask) { lastIndex++; arrSameTasks[lastIndex] = someTask; } void Show() { for (int i = 1; i <= lastIndex; i++) cout << arrSameTasks[i] << " "; cout << endl; } bool SameTasksFounded(int arrToCheck[], int n) { for (int i = 1; i <= lastIndex; i++) { for (int j = 1; j <= n; j++) { if (arrSameTasks[i] == arrToCheck[j]) return true; } } return false; } }; class TempTours // промежуточные расположения задач в турах { public: TempTours() {} int tempTour1[101], tempTour2[101], tempIndex1, tempIndex2; void CreateData(int tour1[], int tour2[], int index1, int index2) { for (int i = 1; i <= index1; i++) tempTour1[i] = tour1[i]; for (int i = 1; i <= index2; i++) tempTour2[i] = tour2[i]; tempIndex1 = index1; tempIndex2 = index2; } int IndDifference() { return abs (tempIndex1 - tempIndex2); } void Show() { cout << "\ntempTour1:\n"; for (int i = 1; i <= tempIndex1; i++) cout << tempTour1[i] << " "; cout << "\ntempTour2:\n"; for (int i = 1; i <= tempIndex2; i++) cout << tempTour2[i] << " "; } }; bool MakeArrays(Task allTasks[], int n, int tour1[], int tour2[], int &index1, int &index2, int freeTasks[], int &indexFree) { bool ListsChanged; // будем проверять, сделаны ли изменения в списках туров for (;;) { indexFree = 1; ListsChanged = false; for (int i = 1; i <= 2*n; i++) { if (!(allTasks[i].IsInTour)) // поиск первой свободной задачи { if (!(allTasks[i].SameTasksFounded(tour1, index1))) // если в 1-ом туре не найдено подобных задач,... { // ...а во 2-ом туре такие есть или число задач в командах сейчас равно if (allTasks[i].SameTasksFounded(tour2, index2) || index1 == index2) { if (index1 > n) // а тут мы превысили число задач в одном туре { cout << "IMPOSSIBLE"; return false; } tour1[index1] = i; index1++; allTasks[i].IsInTour = true; // помещаем ее в 1-ый тур ListsChanged = true; } else // а если нет "врагов" ни там, ни там + индексы не равны { freeTasks[indexFree] = i; indexFree++; } } else // если в 1-ом туре есть подобные задачи,... { if (!(allTasks[i].SameTasksFounded(tour2, index2))) // ...а во 2-ом их нету { if (index2 > n) // тут мы опять превысили число задач в одном туре { cout << "IMPOSSIBLE"; return false; } tour2[index2] = i; index2++; allTasks[i].IsInTour = true; // помещаем ее во 2-ой тур ListsChanged = true; } else // а если "враги" повсюду { cout << "IMPOSSIBLE"; return false; } } } } if (!ListsChanged) // наконец, когда списки перестали меняться return true; } } int Max(int arr[], int n) { int max = arr[0], maxIndex = 0; for (int i = 1; i < n; i++) if (arr[i] > max) { max = arr[i]; maxIndex = i; } return maxIndex; } int main() { freopen("input.txt", "r", stdin); int n, m; cin >> n >> m; Task * allTasks = new Task[2*n+1]; // массив всех задач int task1, task2; for (int i = 1; i <= m; i++) { cin >> task1 >> task2; allTasks[task1].AddSameTask(task2); allTasks[task2].AddSameTask(task1); } /*for (int i = 1; i <= 2*n; i++) { cout << "Same tasks for task " << i << ": \n"; allTasks[i].Show(); }*/
int tour1[51], tour2[51]; // задачи 1-ого тура, задачи 2-ого тура int index1 = 1, index2 = 1; // индексы, указывающие, куда вставлять очередную задачу int freeTasks[101], indexFree = 1; // здесь будут храниться временно незанятые задачи, у которых на момент проверки не будет "врагов" ни в одном туре TempTours * arrTempTours = new TempTours[2*n+1]; int indexTemp = 0; // Проход по всем задачам и генерация временных пар массивов задач for (;;) { indexFree = 1; index1 = 1; index2 = 1; if (!MakeArrays(allTasks, n, tour1, tour2, index1, index2, freeTasks, indexFree)) return 0; index1--; index2--; arrTempTours[indexTemp].CreateData(tour1, tour2, index1, index2);
//cout << "\narrTempTours[" << indexTemp << "]:"; //arrTempTours[indexTemp].Show(); indexTemp++; if (indexFree == 1) break; } indexFree = 1; index1 = 1; index2 = 1; int * arrDiff = new int[2*n+1]; for (int i = 0; i < indexTemp; i++) arrDiff[i] = arrTempTours[i].IndDifference(); for (int i = 0; i < indexTemp; i++) { int tempInd1 = arrTempTours[Max(arrDiff, indexTemp)].tempIndex1; int tempInd2 = arrTempTours[Max(arrDiff, indexTemp)].tempIndex2; if (index1 == index2) { for (int j = index1; j < index1 + tempInd1; j++) tour1[j] = arrTempTours[Max(arrDiff, indexTemp)].tempTour1[j-index1+1]; index1 += tempInd1; for (int j = index2; j < index2 + tempInd2; j++) tour2[j] = arrTempTours[Max(arrDiff, indexTemp)].tempTour2[j-index2+1]; index2 += tempInd2; } else { if (index1 < index2) { if (tempInd1 > tempInd2) { for (int j = index1; j < index1 + tempInd1; j++) tour1[j] = arrTempTours[Max(arrDiff, indexTemp)].tempTour1[j-index1+1]; index1 += tempInd1; for (int j = index2; j < index2 + tempInd2; j++) tour2[j] = arrTempTours[Max(arrDiff, indexTemp)].tempTour2[j-index2+1]; index2 += tempInd2; } else { for (int j = index1; j < index1 + tempInd2; j++) tour1[j] = arrTempTours[Max(arrDiff, indexTemp)].tempTour2[j-index1+1]; index1 += tempInd2; for (int j = index2; j < index2 + tempInd1; j++) tour2[j] = arrTempTours[Max(arrDiff, indexTemp)].tempTour1[j-index2+1]; index2 += tempInd1; } } else { if (tempInd1 < tempInd2) { for (int j = index1; j < index1 + tempInd1; j++) tour1[j] = arrTempTours[Max(arrDiff, indexTemp)].tempTour1[j-index1+1]; index1 += tempInd1; for (int j = index2; j < index2 + tempInd2; j++) tour2[j] = arrTempTours[Max(arrDiff, indexTemp)].tempTour2[j-index2+1]; index2 += tempInd2; } else { for (int j = index1; j < index1 + tempInd2; j++) tour1[j] = arrTempTours[Max(arrDiff, indexTemp)].tempTour2[j-index1+1]; index1 += tempInd2; for (int j = index2; j < index2 + tempInd1; j++) tour2[j] = arrTempTours[Max(arrDiff, indexTemp)].tempTour1[j-index2+1]; index2 += tempInd1; } } } if (index1-1 > n || index2-1 > n) // переполнение числа задач в одном туре { cout << "IMPOSSIBLE"; return 0; } arrDiff[Max(arrDiff, indexTemp)] = -1; } for (int i = 1; i <= n; i++) cout << tour1[i] << " "; cout << "\n"; for (int i = 1; i <= n; i++) cout << tour2[i] << " ";
return 0; } I've been trying to get AC with this program for 2 days and... yes, it's rather big. Somebody, if you've got a heart, please give me test #3! )) Edited by author 17.09.2010 02:31 | | You CAN got AC with RANDOM method, but you need to be more careful. | 198808xc | 1363. Halftones | 16 Sep 2010 23:03 | 1 | The testcases, after rejudgement, are harder than before. So I really wonder if simply randomization could get AC. I first wrote a program WHOLLY random, and got WA at 4. Then I added the checking part of my program. When one-round randomization failed, I will start another, and so on. Then I got TLE at 14, 15 or 19 (I have tried about 10 times). Finally, I realised that I must modify the random part. So I made a improvement: when I try to find the value of one pixel, I will take the PROCESSED pixel which could have the impression on that pixel into consideration. And I will adjust the random argument basing on these infos. This time I got AC. Wish my method will be helpful. | | Commemorate my 100th Accepted... | lrcrichard | 1617. Flat Spots | 16 Sep 2010 22:20 | 1 | | | If you wa 11 try this test: | LSBG | 1075. Thread in a Space | 16 Sep 2010 15:26 | 1 | I had WA 11 and this test helped me: 0 0 0 0 0 10 0 1 168 7 Correct answer is 10.00. In short the problem is that the distance between C and the line between A and B is less then R but still the thread doesn't pass through the ball. | | WA #6 | Sandello | 1357. Teakettle 1.0 for Dummies | 15 Sep 2010 18:04 | 3 | WA #6 Sandello 6 Jan 2010 03:07 What could be in this test? Can you give me some tests? Finally i got AC. I don't know my mistake, i just rewrote my code :) Re: WA #6 Yusupov Azat(UB of TUIT) 15 Sep 2010 18:04 Can you give me any test? I have WA #6 too.But I couldn't find my mistake. My adres azat.1990@mail.ru Edited by author 15.09.2010 18:04 AC Edited by author 12.06.2013 17:10 | | To ADMIN: Why do my program get WA? | 198808xc | 1396. Maximum. Version 2 | 14 Sep 2010 23:23 | 2 | I submitted my program to 1079 and get AC. It at least shows that my ALGO work for small data. By the way, my answer for 10^18 is 2504730781961 Is it right? Maybe the 'int64' or some problems like this make me WA. Could you please tell me why? I am confused. Thanks in advance. Well, sorry to ADMIN. I have found my mistake and now I have AC. BTW, my answer for 10^18 is correct. |
|
|