Common Board| Show all threads Hide all threads Show all messages Hide all messages | | admin,please check test case 18 | Shen Yang | 1589. Sokoban | 7 Dec 2017 12:01 | 2 | I think this is a no solution test I output empty and pass this test... wa haha AC again,hahahaha two hardest problems | | Um... Okay | Fast Bastards | 1100. Final Standings | 7 Dec 2017 12:00 | 1 | #include <bits/stdc++.h> #define pb push_back using namespace std; int main() { int n; cin >> n; vector<pair<int, int> > v; int x, p; for(int i = 1; i <= n; i ++) { cin >> x >> p; v.pb({p, x}); } sort(v.begin(), v.end()); reverse(v.begin(), v.end()); for(int i = 0; i < n; i ++) { cout << v[i].second << " " << v[i].first << "\n"; } } But it is same sort | | My code crashed at 10th test | YuYu8 | 1067. Disk Tree | 6 Dec 2017 20:58 | 1 | I implemented a prefix tree using pointers and it crashed. I don't know why : for me it worked at max test. But as soon as I moved to an array implementation, it worked! | | wa22 | AGrigorii [Yaroslavl SU]🔥 | 1937. Davy Jones’s Organ | 6 Dec 2017 11:05 | 2 | wa22 AGrigorii [Yaroslavl SU]🔥 5 Jul 2017 18:03 AC by anti-"antihash-test" hash approach. Edited by author 06.12.2017 11:06 | | How I solved it. | Nikita Mogilevets | 1792. Hamming Code | 5 Dec 2017 20:25 | 2 | I have used bitmasks. There are only 16 possible Hamming codes. So, I have precalculated. Then check, whether input is a valid code. Then try to find such valid code that it differs from input in exactly one position (I have used xoring for that) and print that codr. Don't forget about zero code. That is a special case. Можно ведь и проще гораздо) Составить три булевых функции (они вполне конкретно прописаны в условии), принимать за ошибку по очереди каждую цифру и смотреть, какие из функций при этом должны вернуть истину, а какие ложь. Остаётся прописать 8 if, один из них будет на код без ошибок, остальные - на соответствующую ошибку. Остаётся её исправить и вывести ответ) | | WA6: use this stupid code for correct input | dgorlov | 1316. Electronic Auction | 4 Dec 2017 16:00 | 4 | i have WA6 for correct input of price use procedure like this int read_price(void) { double f; fscanf(inf,"%lf",&f); return (int)((f+1e-9)*100.0); } and you got AC Thank you very much!I got AC Can you explain me please when expressions (int) (f * 100) and (int)((f+1e-9)*100.0)can differ. (I got AC after using this method, but still can't figure out what the problem is). Thanks in advance :) Edited by author 07.10.2013 03:17 I don't understand ! Why when I read data like integer before and after point : int price = before * 100 + after -> is wa6 and when I read data like double: double d; scanf("%lf, &d); int price = (int)(d * 100.0 + 0.1) -> is ok | | How to use DP in this problem? | Karolis Kusas | 1427. SMS | 3 Dec 2017 20:44 | 4 | Hello. Could somebody tell me a right DP approach to this problem. I couldn't figure out the solution better than O(|S|*M). |S| - length of the string. Easy problem. Let dp[i] - answer for string S1..Si. Then dp[i]=min(dp[i],dp[i-n]+1). (Maximum possible N-characters message). If last_idx - index of last "bad" character, then dp[i]=min(dp[i],dp[max(last,i-m)]+1). If current character is "bad" - update last_idx. It's O(|S|) solution. A pure greedy problem. You don't need to use any array, the algorithm is very simple: For each characters, just check if you can add it to the current message, if not you will create a new message and then add it to this message. What is the BAD character in string??? | | 600 lines of code to get wa21 :( | Martin_fmi | 1199. Mouse | 3 Dec 2017 20:28 | 4 | Hi everybody, After a lot of testing I have wa21 ... Is there anything spacial about this test case ? Thanks in advance. Edited by author 18.07.2009 22:28 Yes, be sure you will not output more than 1000 vertices. | | C hint WA №1 | CebanA | 1068. Sum | 3 Dec 2017 19:52 | 1 | int n,i=0; -- AC int n,i; -- - WA №1 | | What is wrong? WA#4 | Panov Evgenij`~ | 2031. Overturned Numbers | 2 Dec 2017 15:40 | 2 | import java.util.Scanner; public class ex2031 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int n=sc.nextInt(); if(n==1){ System.out.println("11"); }else{ if(n==2){ System.out.println("11"+" "+"01"); }else{ if(n==3){ System.out.println("001"+" "+"66"+" "+"86"); }else{ if(n==4){ System.out.println("16"+" "+"06"+" "+"68"+" "+"88"); }else{ System.out.println("Glupenky Pierre"); } } } } } } Он не может использовать трёхзначные числа | | Some useful tests | platonshubin | 1768. Circular Strings | 2 Dec 2017 14:14 | 2 | One of them was found on the forum, too. 4 0 0 0 1 1 1 1 0 YES 5 0,654508 0,0244717 0,0954915 0,206107 0,0954915 0,793893 0,654508 0,975528 1 0,5 YES 5 1 0,5 0,654508 0,975528 0,0954915 0,793893 0,0954915 0,206107 0,654508 0,0244717 YES 12 -0,1 0,3 0,1 0,3 0,1 0,1 0,3 0,1 0,3 -0,1 0,1 -0,1 0,1 -0,3 -0,1 -0,3 -0,1 -0,1 -0,3 -0,1 -0,3 0,1 -0,1 0,1 NO 8 0 0 0 -1 1 -1 1 0 0 0 0 1 1 1 1 0 NO 5 0.654508 0.0244717 0.0954915 0.206107 0.0954915 0.793893 0.654508 0.975528 1 0.5 5 1 0.5 0.654508 0.975528 0.0954915 0.793893 0.0954915 0.206107 0.654508 0.0244717 12 -0.1 0.3 0.1 0.3 0.1 0.1 0.3 0.1 0.3 -0.1 0.1 -0.1 0.1 -0.3 -0.1 -0.3 -0.1 -0.1 -0.3 -0.1 -0.3 0.1 -0.1 0.1 Edited by author 02.12.2017 15:12 | | Wrong answer test 9 | Леонид | 2056. Scholarship | 2 Dec 2017 13:10 | 1 | | | Helpful TEST CASES | Dmitriy | 1027. D++ Again | 2 Dec 2017 02:48 | 2 | Note*: if you have WA1 just skip all #10 and #13 symbols from input data! ((*Answer is YES*)) (((*Answer is YES*))) (**) YES (* NO (*) NO (*(*) YES (11(*)) NO (*(**)*) NO ((**)*)(**)*) NO! ((**)*) YES ()() (()) ((())) YES (1+1 ) YES THANK YOU very much for "(*(*) YES"! | | Disappointment | YuYu8 | 1026. Questions and Answers | 2 Dec 2017 00:50 | 1 | Just sort() numbers... It will take approximately 1e5 * log(1e5) ≈ 1e6 operations, which is not that long to compute. Edited by author 02.12.2017 00:54 | | Assembler in Pascal | Zinovij | 1225. Flags | 1 Dec 2017 20:47 | 1 | var n:Integer; r:cardinal; begin read(n); asm xor eax,eax mov ebx,eax inc eax mov esi,eax mov edi,eax mov ecx,1 shl 5 @@3: or ecx,ecx je @@1 mov eax,ebx mul eax mov ebx,eax mov eax,esi mul eax add eax,ebx mov esi,eax mov eax,edi mul eax add eax,ebx mov edi,eax sub eax,esi mov ebx,eax test n,ecx je @@2 add edi,ebx add ebx,esi mov esi,edi sub esi,ebx @@2: shr ecx,1 jmp @@3 @@1: mov eax,ebx shl eax,1 mov r,eax end; write(r); end. | | Share the tests | Irysskin | 1147. Shaping Regions | 1 Dec 2017 19:31 | 1 | I can not find the error. Share the tests, please | | WA#12 | Frenzyk | 1510. Order | 1 Dec 2017 17:05 | 1 | WA#12 Frenzyk 1 Dec 2017 17:05 #include <stdio.h> int main(){ int i,n,x,y,z,x1=0,y1=0,z1=0; scanf("%d",&n); int* A=new int[n]; for(i=0;i<n;i++) scanf("%d",&A[i]); x=A[0]; i=1; y=-100; while(1){ if(A[i]==x) x=A[i]; else if(A[i]!=y) y=A[i]; else { z=A[i]; break; } i++;} for(i=0;i<n;i++) { if(A[i]==x) x1++; else if(A[i]==y) y1++; else if(A[i]==z) z1++; } if(x1>y1 && x1>z1) printf("%d",x); else if (y1>z1 && y1>x1) printf("%d",y); else if (z1>x1 && z1>y1) printf ("%d",z); return 0; } | | test case 7 | Shen Yang | 1834. Tennis Racket | 1 Dec 2017 07:28 | 2 | 20 19 17 15 13 11 9 7 5 3 1 2 4 6 8 10 12 14 16 18 20 ans: 5 17 13 9 5 1 2 6 8 10 12 14 16 18 20 4 3 7 11 15 19 1 2 8 12 16 20 7 11 15 19 3 4 18 14 10 6 5 9 13 17 1 2 12 20 11 19 3 4 18 10 9 17 13 5 6 14 15 7 16 8 1 2 20 19 3 4 18 17 5 6 7 8 16 15 14 13 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 I don't have test only use handle binary search get the test, and find answer with eyes... my programme output 6,so it must be smaller than 6... finally I get AC, it is O(n*lg(n)) sol | | No subject | Dok32 | 1000. A+B Problem | 30 Nov 2017 22:04 | 1 | var a,b,c:integer; begin read(a,b); writeln(a+b); end. | | Wrong answer (Test 1) | Damir | 1000. A+B Problem | 28 Nov 2017 22:08 | 2 | program SumAB; var a,b:integer; begin Assign(input,'input.txt'); Reset(input); Assign(output,'output.txt'); Rewrite(output); Readln(a,b); Writeln(a+b); Close(input); Close(output); end. При таком коде возникала ошибка. Написал program SumAB; var a,b:integer; begin Readln(a,b); Writeln(a+b); end. Система приняла. Т.е что получается, не нужно писать имена входного/выходного файлов? А в других задачах тот же принцип? Читайте FAQ. http://acm.timus.ru/help.aspx?topic=pascalВ самом конце есть следующая конструкция: {$IFNDEF ONLINE_JUDGE} assign(input, 'input.txt'); reset(input); assign(output, 'output.txt'); rewrite(output); {$ENDIF} readln(a, b); writeln(a + b); {$IFNDEF ONLINE_JUDGE} close(input); close(output); {$ENDIF} которая означает, что на вашем компьютере данные будут читаться из input.txt и писаться в output.txt, а на сервере будет использоваться стандартный ввод-вывод. |
|
|