Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | WA 24! | Ak@demik | 1534. Гондорский футбол | 29 сен 2013 17:04 | 1 | WA 24! Ak@demik 29 сен 2013 17:04 Why WA 24? ... Give me some tests, please. | | What is algo? | IgorKoval [PskovSU] | 1669. Универсальное слово | 29 сен 2013 16:23 | 2 | simple DP: int leftPos[char][pos] position of char which is left or equal of pos int lastPos[mask] : for substring s[lastPos[mask]..s.length()-1] we can get all name of sportman with char which is in mask. =) | | Please help. WA Test 6/ Помогите, пожалуйста. Неправильный ответ. Тест 6 | Alex | 1787. Поворот на МЕГУ | 29 сен 2013 15:41 | 2 | Не могу разобраться в чем ошибка. using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(' '); string[] d = Console.ReadLine().Split(' '); int x = 0; int n = int.Parse(s[0])*int.Parse(s[1]); for (int i = 0 ; i < int.Parse(s[1]) ; i++) { x = x + int.Parse(d[i]); } if (x > n) { x = x - n; } else x = 0; Console.WriteLine(x); } } } Вопрос снят. Ошибку нашел. | | ac code | JDBaha | 1877. Велосипедные коды | 28 сен 2013 23:10 | 6 | #include <iostream> int main() { int k1,k2; int count=0; int flag=1;
std::cin>>k1>>k2; for(;;) { if(flag==1) { if(count==k1) { std::cout<<"yes"; return 0; } count++; flag=-flag; } if(flag==-1) { if(count==k2) { std::cout<<"yes"; return 0; } count++; flag=-flag; } if(count>k1 && count>k2) { std::cout<<"no"; return 0; } }
} a better way: #include<iostream> using namespace std; int main(){ int lock1,lock2; cin>>lock1>>lock2; if(lock1%2==0||lock2%2==1){ cout<<"yes"; }else{ cout<<"no"; } return 0; } 1st. code is correct, but does not meet the requirements of the problem .. based on the conditions of the problem, such a check should be: if((a>0 && a <= 9999 && a%2 == 0)||(b>=0 && b <=9999 && b%2 ==1)) cout << "yes"; else cout << "no"; 0000 excluded from the search because the code has been entered., + indicated that a strictly four digit string to the test unchecked .. verdict .. flawed testing Edited by author 12.02.2013 17:11 #include <iostream> using namespace std; int main(){ int l,b; cin>>l>>b; l%2==0 || b%2==1 ? cout<<"yes" : cout<<"no"; } Edited by author 29.09.2013 13:22 Edited by author 29.09.2013 13:22 What's the meaning of your code ? and I'm not sure what's the main method to steal the bike by the thief. Could you mind tell me ? Edited by author 05.11.2012 22:48 you can see that thief is testing even code on night 1, 3, 5... and odd code on night 2, 4, 6... So thief can steal the bike if the code is even on night 1, 3, 5... and odd code on night 2, 4, 6... Code may be even on night 1,3,5 only if first lock have even code. Code may be odd on night 2,4,6 only if second lock have odd code. So you have to check only if first lock have even code or second have odd code. | | Who solve this problem with DP, | ural_ghost | 1005. Куча камней | 28 сен 2013 19:10 | 8 | I have solved it with Dp in 0.015. Is there anyone fast(DP)? I'd be more interested in your memory strategy. I don't think DP alg will differ much for the same problem Maybe the test data are so simple, and DP is able to accept. But I don't think DP method is right. dp(bug task) and bruteforce (2^n) are both accepted for me it got accepted with brute force Time : 0.015 (I think its the minimal time) C++ using maps and vectors Used DP Want d code? gaston770@gmail.com Less than 15 lines of the algorithm My solution cost monstrously 0.187s using DP... Легко решается с динамическим програмированием. Делишь сумму камней на 2 части, потом запускаешь рюкзак до суммы камней/2, ответом будет являться abs(sum-2*maxx), где sum - сумма камней, а maxx - макс. вес, который мы можем поместить в наш "рюкзак" | | test case #7 fail. please give it for me! | 1212314 | 1106. Две команды | 28 сен 2013 17:12 | 1 | test case #7 fail. please give it for me! | | What is Test 8? | karan | 1183. Brackets Sequence | 28 сен 2013 06:44 | 1 | Can anybody tell what is Test 8. Getting WA. | | Wrong Answer | 1212346 | 1100. Таблица результатов | 27 сен 2013 08:59 | 1 | #include <stdio.h> #include <iostream> using namespace std; #define MAX 15000 struct Team { int ID; int M; }; void Swap(Team &A, Team &B) { Team temp = A; A = B; B = temp; } void QuickSort(Team A[], int left, int right) { int i, j; if (left >= right) return; int x = ((left + right)/2); i = left; j = right; while(i < j) { while (A[x].M < A[i].M) i++; while (A[j].M < A[x].M) j--; if(i <= j) { Swap(A[i], A[j]); i++; j--; } } QuickSort(A, left, j); QuickSort(A, i, right); } void main() { int N; Team A[MAX]; cin >> N; for (int i = 0; i < N; i++) cin >> A[i].ID >> A[i].M; QuickSort(A, 0, N - 1); for (int i = 0; i < N; i++) cout << A[i].ID << " " << A[i].M << endl; } | | Почему не правильно? | Kirill_M | 1009. K-ичные числа | 27 сен 2013 01:46 | 2 | #include <iostream> #include <string> #include <stdio.h> #include <cmath> using namespace std; int n,k,col=0; int main() {
cin>>n>>k; int bo=0; int z,z1; z=pow(10.0,(n-1)); z1=pow(10.0,n); for(int i=z;i<z1;++i) { for (int v = i; v; v /= 10) { if (((v%10)>=k) || (((v%10)==0) && ((v%100)==0))) {bo=1; v=0;}; } if (!bo) ++col; bo=0; } cout<<col; return 0; } Насколько я понимаю, основание может быть отличным от 10, то есть с основанием, 2, 3, 4, 5, 6, 7, 8, 9. Из-за этого и запись разная, например число 31(осн. 10) = 11111(осн. 2) = 51(осн. 6) = 24(осн.8) = 1F(осн. 16). Вот такие пироги. | | Is this looks like correct? | PVD | 1009. K-ичные числа | 27 сен 2013 01:36 | 1 | i have tested it, and it look like working, can you say me is this look like correct, or can you advise me how to fix it?) #include <iostream> using namespace std; int main() { unsigned __int64 n, b, i, r, sum = 0; cin>>n>>b; for (i = 2; i <= n - 1; i++) { r = (n - 1) / i + (n - 1) % i; sum += r * pow(double(b - 1), double(n - i)); } cout<<unsigned __int64(pow(double(b), double(n)) - pow(double(b), double(n - 1)) - sum)<<endl; //system("pause"); } | | Test 43 | Radostin Chonev | 1593. Квадратная страна. Версия 2 | 26 сен 2013 20:31 | 1 | Test 43 Radostin Chonev 26 сен 2013 20:31 Can anyone help me ? I have WA on test 43 . Thanks for your attention . | | Compilation error | Evgeniy_Chernobrovkin(MUCTR-2013) | 1025. Демократия в опасности | 26 сен 2013 03:01 | 1 | #include "stdafx.h" #include <iostream> #include <conio.h> using namespace std; void bubbleSort(int array[], int col){ int temp=0; for (int i=1; i<col ; i++){ for (int j=0; j<col-i; j++){ if (array [j]>array [j+1]){ temp=array[j]; array [j]=array [j+1]; array [j+1]=temp; } } } } int _tmain(int argc, _TCHAR* argv[]) { int k; int max; int sum; sum = 0; max = 0; cin >> k; int *p = new int[k-1]; int i; for (i = 0; i < k; i++) { cin >> p[i]; }
bubbleSort(p, k-1); k=k/2+1; for (i=0; i<k; i++) { sum = sum + p[i]/2+1; } cout << sum; _getch(); return 0; } kgxvh8-ov2fjo kgxvh8-ov2fjo(1) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory What's wrong? There is no problem in Visual Studio 12 :( | | I use Dynamic Prog. May Be It's wrong. Help with test or hint, please. WA#3 | exwRabbits_AlMag(VNTU) | 1156. Два тура | 25 сен 2013 23:00 | 7 | My programm passes all my tests, but WA#3. Please, help. Thanks a lot. How you here have applied Dinamic Prog.? I the ambassador aside graph. Hi, Taras. I use simple method: I read two variables ot and ku. If ot and ku are in the same group, I Output('IMPOSSIBLE'); If they are in the different groups then I Continue else I put one variable into the first group and other into the second group. After that I divide "free" tasks between the groups... I hoped that It would get more than two tests... May be I should try to use graphs... BTW, tell me youre ICQ number, I cann't find you... Edited by author 02.05.2006 13:17 try this test, maybe will help you: 4 6 1 2 2 3 3 4 4 5 6 7 7 8 ANS: 1 3 5 7 2 4 6 8 You can use it. I used it as well. First you must paint the graph with black and white (use BFS) so that two vertices with the same edge are of different colors. After that you have pairs of integers and you have to combine them so that you have N in each round (that's not always possible). how I should combine them ?? | | Wrong answer on test 2 !!!! | Narek X | 1809. Чапаев и картошка | 25 сен 2013 18:26 | 1 | Thenks, I have AC Edited by author 27.09.2013 15:34 | | WA 27? | jjohn | 1643. Атака Тёмной крепости | 25 сен 2013 13:25 | 1 | WA 27? jjohn 25 сен 2013 13:25 I think my program is correct, but i've gotten wa 27 three times. Does anyone know what this test iss? | | Why WA4 | KartonArmadon | 1581. Работа в команде | 24 сен 2013 18:16 | 1 | Why WA4 KartonArmadon 24 сен 2013 18:16 Sorry please, i find mistake... Edited by author 24.09.2013 18:26 | | Why WA on test 10? | Николай | 1880. Собственные числа Psych Up | 24 сен 2013 17:47 | 1 | #include<iostream> #include<math.h> using namespace std; int main() {int t=0; int a,b,c; int d=0; long A[4001]; long B[4001]; long C[4001]; long D[4001]={0}; cin >> a; if(a <1 || a > 4000) exit(0); for(int i=0;i<a;i++) { cin >> A[i]; if(A[i] < 0 || A[i] >1000000000) exit(0); } cin >> b; if(b < 1 || b > 4000) exit(0); for(int i=0;i<b;i++) { cin >> B[i]; if(A[i] < 0 || B[i] >1000000000) exit(0); } cin >> c; if(c < 1 || c > 4000) exit(0); for(int i=0;i<c;i++) { cin >> C[i]; if(A[i] < 0 || C[i] >1000000000) exit(0); } for(int i=0;i<a;i++) for(int j=0;j<b;j++) if(A[i] == B[j]) { D[i]=A[i]; B[j]=0; t++; break; } for(int i=0;i<t;i++) for(int j=0;j<c;j++) if(D[i] == C[j]) { d++; C[j]=0; break; } cout << d; system("pause"); return 0; } | | Why I get wrong? | dejiyu | 1076. Trash | 24 сен 2013 16:57 | 2 | program djy; var a:array[1..150,1..150] of integer; lx,ly,link:array[1..150] of integer; flagx,flagy:array[1..150] of boolean; n:longint; procedure init; var i,j:longint; begin readln(n); for i:=1 to n do for j:=1 to n do read(a[i,j]); end; procedure prepare; var i,j,s:longint; begin {for i:=1 to n do begin s:=0; for j:=1 to n do s:=s+a[j,i]; for j:=1 to n do a[j,i]:=a[j,i]-s; end;} fillchar(lx,sizeof(lx),0); fillchar(ly,sizeof(ly),0); for i:=1 to n do for j:=1 to n do if a[i,j]>lx[i] then lx[i]:=a[i,j]; end; function find(i:longint):boolean; var j:longint; begin flagx[i]:=true; for j:=1 to n do if (lx[i]+ly[j]=a[i,j]) and (flagy[j]=false) then begin flagy[j]:=true; if (link[j]=0) or (find(link[j])=true) then begin link[j]:=i; find:=true; exit; end; end; find:=false; end; procedure main; var i,j,k,d:longint; begin fillchar(link,sizeof(link),0); for k:=1 to n do repeat fillchar(flagx,sizeof(flagx),false); fillchar(flagy,sizeof(flagy),false); if find(k)=true then break; d:=maxint; for i:=1 to n do for j:=1 to n do if (flagx[i]=true) and (flagy[j]=false) and (lx[i]+ly[j]-a[i,j]<d) then d:=lx[i]+ly[j]-a[i,j]; for i:=1 to n do if flagx[i]=true then lx[i]:=lx[i]-d; for i:=1 to n do if flagy[j]=true then ly[j]:=ly[j]+d; until false; end; procedure print; var i,j,s:longint; begin s:=0; for i:=1 to n do for j:=1 to n do s:=s+a[i,j]; for i:=1 to n do s:=s-a[link[i],i]; writeln(s); end; begin init; prepare; main; print; end. You gotta use A+B code. I don't remember the correct algorithm but you can find'em in the tutorial. I got AC. Seriously. | | TO ADMIN (NOT problem specific) Time Limit On Submission | Diaz900 | 1008. Кодирование изображений | 24 сен 2013 05:17 | 3 | These days I've noticed that some programmer got stuck on BIG problems like "ships version 2", which may cost up to tens of seconds to judge. However the general limit for submitting a solution is 10 second. So, you see a whole lot page of 'waiting'. Maybe increase the interval for these problems? I think it is bad idea to tighten rules because of one genius (who made about 1000 submissions on the problem in several hours) - better just to ban it. But, since it is easy to register again, a good idea for timus maybe to restrict the number of submissions of one user (or from one IP) during the last 24 hours (at most 100, for example). Edited by author 20.09.2013 02:27 Edited by author 20.09.2013 08:33 Sounds readonable. Let's see what the admin has to say lol | | What is wrong? | pimiento | 1785. Трудности локализации | 24 сен 2013 01:52 | 2 | truth_table = { 'few': lambda x: x > 0 and x < 5, 'several': lambda x: x > 4 and x < 10, 'pack': lambda x: x > 9 and x < 20, 'lots': lambda x: x > 19 and x < 50, 'horde': lambda x: x > 49 and x < 100, 'throng': lambda x: x > 99 and x < 250, 'swarm': lambda x: x > 249 and x < 500, 'zounds': lambda x: x > 499 and x < 1000, 'legion': lambda x: x > 999 } def translate_count(count): for result, func in truth_table.items(): if func(count): return result translate_count(raw_input(u"Number: ")) Проверку локально проходит, может нужно не так обрабатывать входные параметры? It's strange but it works for Python3 (with corrections for print and input). |
|
|