| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| Wrong Answe test 4 java | shagi | 1313. К вопросу о спорте | 2 окт 2014 18:54 | 1 |
I don't understand what's wrong? In my IDEA all works! import java.io.IOException; import java.util.Scanner; public class summa { public static void main(String[] args) throws IOException { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] mas = new int[n*n]; if(n!= 0) { for (int i = 0; i < n * n; i++) { mas[i]=s.nextInt(); } if(mas.length>1) { qSort(mas, 0, mas.length-1); for (int i = 0; i < mas.length; i++) { System.out.print(mas[i] + " "); } }else System.out.println(mas[0]); }else System.out.println("0 элемнтов"); } public static void qSort(int[] A, int low, int high) { int i = low; int j = high; int x = A[(low+high)/2]; do { while(A[i] < x) ++i; while(A[j] > x) --j; if(i <= j){ int temp = A[i]; A[i] = A[j]; A[j] = temp; i ++ ; j --; } } while(i <= j);
if(low < j) qSort(A, low, j); if(i < high) qSort(A, i, high); } } Edited by author 02.10.2014 20:36 Edited by author 02.10.2014 20:36 |
| WA #10 (+) | Vedernikoff 'Goryinyich' Sergey (HSE: АОП) | 1460. Проводники | 1 окт 2014 01:31 | 1 |
WA #10 (+) Vedernikoff 'Goryinyich' Sergey (HSE: АОП) 1 окт 2014 01:31 Any suggestions of the test? I rewrote solution from numerical to purely geometric, but still WA #10 and I can't find the reason. |
| What is Test#3 | sonamon | 1993. Чизбургер этот не нужен тебе | 1 окт 2014 00:20 | 2 |
Can anyone provide with more tests? especially Test#3 ? (We) [are] {blind}, (we) [could not see] {creation of this clone army} |
| Hint | PrankMaN | 1353. Миллиардная Функция Васи | 30 сен 2014 22:12 | 3 |
Hint PrankMaN 30 мар 2013 17:47 It's not the easiest problem and I don't know good solution, but if I was on the olympiad and would have to solve the problem, I would just precalculate the answer. a difficult combinatorics problem. x1 + x2 +... + x10 = S with limitation: xi between ? , ? Need to fill an array COUNT[1..9][0..81] and answer is COUNT[9][S] Exclusion: if S == 1, then answer is 10 Edited by author 30.09.2014 22:13 |
| [Pascal] | Pham Le Tuan Nam | 1083. Факториалы!!! | 28 сен 2014 09:02 | 1 |
[Pascal] Pham Le Tuan Nam 28 сен 2014 09:02 Why "Time limit exceeded" ??? Edited by author 28.09.2014 09:03 |
| For C++ programmers | evggenshch | 1020. Ниточка | 27 сен 2014 23:06 | 2 |
Use G++ 4.7.2. G++ 4.7.2 C11 works wrong. I don't know about 2013, but C11 works fine now. |
| Please help Time limit problem=1100 | Rakhmatov Izzat | | 26 сен 2014 23:33 | 1 |
import java.util.Scanner; public class Acm { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for(int j = 0; j < n; j++){ Scanner u = new Scanner(System.in); a[j] = s.nextInt(); b[j] = s.nextInt(); }
for(int p = 100; p >= 0; p--){ for(int q = 0; q < n; q++){ if(b[q] == p){ System.out.println(a[q] + " " + b[q]); } } } } } Edited by author 26.09.2014 23:34 |
| hint for some one that want to think more... | mhg | 1319. Отель | 26 сен 2014 21:48 | 1 |
hi,i know! there are some solution in this discussion that is a dangerous thing for someone that want to think more... so i say something about this problem for only hint.. for solving this problem this is better to check 2 or 3 example then consider a general case with n as input then try to simulate the answer and in the final step code it. be successful... |
| WA 8 | Lesha | 1248. Сумма последовательности | 26 сен 2014 12:15 | 1 |
WA 8 Lesha 26 сен 2014 12:15 I tried everything before I realized that my program should accept numbers like 1.e+1 even if there is no digits after '.'. Weird! I hope this information would be helpful to someone. |
| how is output 383 and not 241 for sample cases | Mayank Punetha | 1119. Метро | 26 сен 2014 00:05 | 3 |
first the person goes to (2,2) from (1,1) +141 then (3,2) +100 so why not 241? (0, 0) -> (1, 1) = sqrt(2) * 100 (1, 1) -> (2, 1) = 100 (2, 1) -> (3, 2) = sqrt(2) * 100 Total: 382.842712475 ~ 383 Edited by author 26.07.2014 17:17 Then shouldnt the problem wording be stated as rounding the solution to the nearest integer? If I just round 382.84 to its integer value, it would be 382. |
| Help me WA# 7 | Passarit_sk125 | 1193. Очередь на зачёт | 25 сен 2014 20:32 | 5 |
My algorithm is 1. sort wait time min -> max 2. variable time declared to add total time 3. add minimal wait time and exam time to var(time) 4. add exam time everybody 5. if time > freetime print time-freetime else print 0 I think my algorithm is right ,but I got WA #7 Could you help me plz? I see. My algorithm has a little mistake. Now I got AC. you're wrong ! Let consider this test : 2 100 50 160 200 250 300 your answer : 100 correct answer : 150 Phan Hoài Nam - Đại học Ngoại ngữ Tin Học TP.HCM - Your test case is wrong. T2 cant be greater than 240 Edited by author 25.09.2014 20:32 Edited by author 25.09.2014 20:33 Try test 2 50 10 50 150 20 200 Answer: 10 |
| Hint | airibo | 1789. В поисках Додекаэдра | 25 сен 2014 12:58 | 2 |
Hint airibo 17 окт 2010 13:45 This problem seems hard but the algo is so simple. if there n pedestals then the m is always 2 * n - 1; if you just at i-pedestal and original is at jth, then 1. if abs(i - j) - even you can catch it if you just walk towards it just by one. 2. if abs(i - j) - odd then you just two times take the i-th pedestal to make the difference even and go to 1. For doing above algo just start from the 1st pedestal to n and take n again then go back to the 2nd pedestal Good luck Edited by author 17.10.2010 13:47 You say m is always 2 * (n-1) or is it (2*n) - 1 whichever it is, your initial logic doesn't even satisfy the given output for n = 3. By your above method m should either be 2 * (3-1) = 4 or (2*3) - 1 = 7 whichever formula you intended to say - none of them satisfy the given output i.e. for n = 3 , m = 2 |
| RuntimeError (1001. Обратный корень) | don`t_even_you | 1001. Обратный корень | 25 сен 2014 01:58 | 1 |
import java.util.*; import java.text.*; public class Test{ public static void main(String args[]){ Scanner in = new Scanner(System.in);
String s;
s = in.nextLine();
char c;
int i = 0;
Double [] mass = new Double [256];
String st = "";
for(int j = 0; j < s.length(); j++){ c = s.charAt(j);
if(c == ' ' || j == s.length() - 1){ //реализация вывода корня mass[255 - i] = Double.valueOf(st);
i++;
st = ""; }
if(c != ' ') st += c; }
DecimalFormatSymbols symbol = new DecimalFormatSymbols(); symbol.setDecimalSeparator('.'); DecimalFormat f = new DecimalFormat("#,##0.0000", symbol);
for(Double d: mass){ if(d != null){ System.out.println(f.format(Math.sqrt(d))); }
} } } Edited by author 25.09.2014 02:00 |
| How to calculate the expected number. | Dextrom | 1887. Карта постоянного пассажира | 24 сен 2014 22:16 | 4 |
When probability from 0~9 different, how to calculate the expected number??? Thank very much!! I have used Dynamic Programming. To do this, you need to store 2^10 states ... I have used Dynamic Programming to get probability. But don't know how to get EP. If probability is equal it's a coupon collector's problem? Please, explane this in more details. |
| Time limit #11 | bilac | 1100. Таблица результатов | 24 сен 2014 00:39 | 1 |
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; import java.io.BufferedReader; import java.io.InputStreamReader; public class hgg { /** * @param args */ public static ArrayList<concho> listcho = new ArrayList<concho>(); public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int a = sc.nextInt(); for (int i = 0; i < a; i++) { listcho.add(new concho(sc.nextInt(),sc.nextInt())); } Collections.sort(listcho, new Comparator<concho>() { public int compare(concho o1, concho o2) { // TODO Auto-generated method stub if(o1.kg<o2.kg) return 1; if(o1.kg>o2.kg) return -1; return 0; } }); for (concho item : listcho) { System.out.println(item.tuoi+" "+item.kg); } } public static class concho { int tuoi; int kg; public concho(int t, int k) { tuoi=t; kg=k; } } } |
| Help. Runtime error (access violation) | Daniel | 1021. Таинство суммы | 23 сен 2014 15:45 | 2 |
Where is my wrong? Why runtime error (access violation)? This is my code- program _1021; var n,i,k,l,m:integer; a,b:array[1..10000] of integer; begin read(n); for i:=1 to n do read(a[i]); read(m); for k:=1 to m do read(b[k]); for i:=1 to n do for k:=1 to m do if a[i]+b[k]=10000 then l:=l+1; if l>=1 then writeln('YES') else writeln('NO'); end. ... a,b:array [1..10000] of integer;... 10000 isn't enough because 1<=n<=50000 |
| WA #1 | mikhsatyshev | 2002. Тестовое задание | 23 сен 2014 15:19 | 1 |
WA #1 mikhsatyshev 23 сен 2014 15:19 I don't understand why WA #1 because I fully tested answer of mu programm and answer on site. They hasn't got differences! Even invisible characters. Here is my code: var n,i,j,fl,k,n1:longint; a,b,d,x:string; y,z:array [1..100] of string; z1:array [1..100] of byte; c:char; begin readln (n); for i:=1 to n do begin fl:=0; a:=''; b:=''; d:=''; readln (x); n1:=length (x); j:=0; repeat j:=j+1; If x[j]<>' ' then a:=a+x[j]; until x[j]=' '; repeat j:=j+1; If x[j]<>' ' then b:=b+x[j]; until x[j]=' '; repeat j:=j+1; If x[j]<>' ' then d:=d+x[j]; until j>=n1; fl:=0; If a='register' then begin for j:=1 to k do If b=y[j] then fl:=1; If fl=1 then writeln ('fail: user already exists') else begin writeln ('success: new user added'); k:=k+1; y[k]:=b; z[k]:=d; z1[k]:=0;end;end; fl:=0; If a='login' then begin for j:=1 to k do If b=y[j] then fl:=j; If fl=0 then writeln ('fail: no such user') else If (fl>0) and (d<>z[fl]) then writeln ('fail: incorrect password') else If (fl>0) and (d=z[fl]) and (z1[fl]=1) then writeln ('fail: already logged in') else begin writeln ('success: user logged in'); z1[fl]:=1;end;end; fl:=0; If a='logout' then begin for j:=1 to k do If b=y[j] then fl:=j; If fl=0 then writeln ('fail: no such user') else If (fl>0) and (z1[fl]=0) then writeln ('fail: already logged out') else begin writeln ('success: user logged out'); z1[fl]:=0;end;end;end; end. |
| test 4# plzz | Shubham Murarka | 1131. Копирование | 20 сен 2014 19:52 | 2 |
|
| question about ranking | TwoEightNine | | 19 сен 2014 22:00 | 2 |
for exmple, i solved a problem when its rank was 300, and now its one is 200. does it mean that my rank decreased for 100??? The problem difficulty is calculated by the formula depending on the number of authors who have solved it and the age of the problem. The fewer new authors solve the problem per unit of time, the greater the difficulty. The difficulties of all problems are updated every night. Author rating is the sum of the difficulties of all his solved problems from the archive. |
| Python variation | JollyGirl.py | 1068. Сумма | 19 сен 2014 18:52 | 1 |
x = int(input()) print(sum(range(min(1,x),max(1,x)+1))) |