Show all threads Hide all threads Show all messages Hide all messages |
what is the test 13 | hell_boy7725 | 1709. Penguin-Avia | 15 Apr 2013 23:22 | 1 |
wrong answer in test 13, help me! Edited by author 15.04.2013 23:26 |
WA #9 | YuriG | 1005. Stone Pile | 15 Apr 2013 15:10 | 2 |
WA #9 YuriG 14 Apr 2013 20:48 What parameters in the test number 9? I found such test: 36 25 12 10 8 7 1 the right answer 1, but I received the response 5 - really the program wrong, the unique decision - search of all possible options! PS: а не по английски тут можно писать? Edited by author 15.04.2013 15:15 |
WA in test 7 | ROY | 1106. Two Teams | 15 Apr 2013 13:23 | 1 |
What is test 7? here is my code. It is working on the available sample inputs. Please help. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Iterator; import java.util.StringTokenizer; /** * * @author proy */ class Reader { static BufferedReader reader; static StringTokenizer tokenizer; /** call this method to initialize reader for InputStream */ static void init(InputStream input) { reader = new BufferedReader(new InputStreamReader(input) ); tokenizer = new StringTokenizer(""); } /** get next word */ static String next() throws IOException { while ( ! tokenizer.hasMoreTokens() ) { //TODO add check for eof if necessary tokenizer = new StringTokenizer(reader.readLine() ); } return tokenizer.nextToken(); } static int nextInt() throws IOException { return Integer.parseInt( next() ); }
static double nextDouble() throws IOException { return Double.parseDouble( next() ); } } public class p1106 {
public static void main(String args[]) throws IOException { int a; Reader.init(System.in);
int n = Reader.nextInt(); int graph[][]= new int[n][n]; ArrayList<ArrayList<Integer>> st = new ArrayList<ArrayList<Integer>>(); ArrayList<Integer> grp1 = new ArrayList<Integer>(); ArrayList<Integer> grp2 = new ArrayList<Integer>(); for (int i = 0; i<n;i++) { ArrayList<Integer> ar = new ArrayList<Integer>(); do { a = Reader.nextInt(); if(a !=0) { graph[i][a-1] = 1; ar.add(a-1); }
} while(a!=0); st.add(ar); }
if(n!=0) { grp1.add(0); for(int i = 1; i<n; i++) { if(graph[0][i]!= 1 ) { grp1.add(i); }
else { grp2.add(i); } }
for(int i = 1; i<grp1.size();i++) { int x = grp1.get(i);
if(!st.get(x).isEmpty()) { boolean frFlag = false; Iterator it = st.get(x).iterator(); while(it.hasNext()) { if(grp2.contains((Integer)it.next())) { frFlag = true; continue; } }
if(!frFlag) { Integer rm = st.get(x).get(0); //grp1.r grp1.remove(rm); grp2.add(rm); } }
}
System.out.println(grp1.size()); Iterator it1 = grp1.iterator(); while(it1.hasNext()) { System.out.print(((Integer)it1.next()+1)+ " "); } }
else { System.out.println(0); }
}
} |
Проблема с 10ым тестом | Abramov Anton | 1843. Cutting a Parallelepiped | 15 Apr 2013 12:53 | 8 |
Подскажите какой пример в 10ом тесте? уперся и ничего не могу поделать. За ранее спасибо Попробуй отладить этот код, мне помогло найти ошибки //string[] source = { "62", "45", "73", "roygbv" }; //string[] ex1 = { "9", "73", "45", "..bvgy" }; //string[] ex2 = { "73", "45", "12", "bvyg.." }; //string[] ex3 = { "45", "7", "73", "gyo.vb" }; //string[] ex4 = { "73", "45", "12", "bvyg.." }; //string[] ex5 = { "73", "4", "45", "bv..gy" }; //string[] ex6 = { "45", "1", "73", "yg.rbv" }; //string[] ex7 = { "73", "1", "45", "vb..gy" }; //string[] ex8 = { "16", "45", "73", "..ygbv" }; Edited by author 13.04.2013 20:53 тут все верно строит, без ошибок Не ахти какая помощь, но все ж 1 - 2 тесты - один целый куб 3 - 4 тесты - два куска 5 - 15 тесты - три куска 16 - 18 тесты - кусков больше трех, точно не знаю сколько. С третьего по 18 тесты включительно разрезание в одной плоскости @r0me: аналогично, без ошибок (ну разве что ответ я не проверял)... я и ответ проверил и в других плоскостях все проверил, и уже почти все что можно вводил, ошибку не выявил( интересно, что же я упустил... Если я правильно понимаю, до 19ого теста в кусочке может быть максимум две точки, для тех что посредине и одна , для тех что по краям? Edited by author 15.04.2013 11:32 А изменение координат идет только по одной оси, то есть в ответе будет 0 0 7- координаты для кусочка, за исключением первого. Так оно? |
(java) memory limit even using PQ<Integer> with capacity = 125'000 | Ozzy | 1306. Sequence Median | 15 Apr 2013 00:43 | 1 |
hi I found some hint about this task (PQ usage with size = n/2+1) and applied it. My class have only PQ<Integer> object and three int variables + StreamTokenizer + System.out. Unfortunately, I've got MLE (1096 Kb). So I think that java needs more than 1 Mb to store 125'001 elements on PQ<Integer> - is it right ? If yes than which way this task can be solved using java ? TIA. |
O(n^2) is the best way or not? | hoan | 1403. Courier | 14 Apr 2013 23:04 | 5 |
No. I solved in in O(nlogn) Can you explain me your algo? thanks in advance. I think you have to use binary tree to implement something. Binary tree? Are you kidding? just quick sorting of array and little thinking. Edited by author 14.04.2013 23:05 |
3 тест | Doshirak | 1843. Cutting a Parallelepiped | 14 Apr 2013 10:54 | 1 |
3 тест Doshirak 14 Apr 2013 10:54 Подскажите пожалуйста пример третьего теста |
Problem with the first test | Drotaverin | 1843. Cutting a Parallelepiped | 13 Apr 2013 23:46 | 11 |
As i have read, the first test is like in example. And i have tried to use a kind of cheat: Console.WriteLine("F D 0 0 0" + Environment.NewLine + "R F 1 0 0"); But i have got "Wrong answer". What have i done wrong? There's no guarantee that the first test is exactly the same as the example. У кого есть предположение, какой пример в первом тесте? В первых двух тестах исходный параллелепипед не имеет разрезов, его только нужно повернуть правильным образом. Числа друг от друга (координаты) разделяются одним пробелом? Пример параллелепипеда без разрезов 1 1 1 ROYGBV 1 1 1 1 GYBVOR R B 0 0 0 Ввод и вывод все так должно быть, ничего не перепутал? Это нормально, я сам эти методы использую. Можешь написать на akaviri93@gmail.com, прислать код, помогу разобраться с ошибкой. Edited by author 13.04.2013 23:50 |
[AC] | Karpov Alexandr | 1709. Penguin-Avia | 13 Apr 2013 08:46 | 2 |
[AC] Karpov Alexandr 9 Jan 2013 17:57 I had a stupid bug and found better to post it here rather than trying to look on my code. Looked, found. Edited by author 09.01.2013 18:03 |
WA 6. Give me some tests, please | Nafania | 1700. Awakening | 12 Apr 2013 20:40 | 1 |
On my data program works fine, but got WA. Help me, please :( I can't understand where is trouble in my code |
WA №4 | daria | 1131. Copying | 12 Apr 2013 18:29 | 1 |
WA №4 daria 12 Apr 2013 18:29 Pleaze, give me some tests that I will be able to find my error. |
Контрпример | Александр | 1843. Cutting a Parallelepiped | 12 Apr 2013 12:33 | 7 |
Подскажите контрпример 7 теста. Prompt a counterexample of the 7th dough. Edited by author 05.04.2013 17:38 Re: Контрпример Vedernikoff 'Goryinyich' Sergey (HSE: АОП) 6 Apr 2013 02:57 MGIMO finished? A-a-ask! =) Тест - test in English Dough == тесто (булочки выпекать) =))) +1 Sergey trolling detected XD Присоединяюсь =) очень хочется увидеть тест 7... 7 тест это три куска, разрезы сделаны параллельно одной из граней. Важно правильно определять ориентацию в случае, когда "внутренних" граней у куска больше чем одна. Edited by author 09.04.2013 11:41 А будет ли важно, как я поставлю эти две грани. Допустим, в описании идёт сначала куб x, затем куб у. Если я поставлю сначала у, затем х, это будет ошибкой? по идее не должно... вариантов то много может быть... в условии же сказано об этом. |
Please look here if you WA on this problem | true1023 | 1106. Two Teams | 12 Apr 2013 12:33 | 2 |
First my code maxn=100 then WA on 8 Second my code maxn=105 then WA on 11 Third my code maxn=200 then WA on 20 Fourth my code maxn=1000 then ......AC Thanks man, i'm very pleased for your help. |
shortest solution contest | pohmelie | 1607. Taxi | 11 Apr 2013 23:57 | 2 |
//c++ #include <iostream> void main() { int ps,pu,ts,td,dif; std::cin>>ps>>pu>>ts>>td; dif=((ts=ps>ts?ps:ts)-ps)/(pu+td); std::cout<<(((ps+=(dif+1)*pu)<(ts-=dif*td))?ps:ts); } // Ruby a,b,c,d=gets.split.map { |x| x.to_i } e=((c=[a,c].max)-a)/(b+d) puts ((a+=(e+1)*b)<(c-=e*d)) ? a : c Edited by author 11.04.2013 23:58 |
What is Test #2 ?? | Nguyen Doan Quoc Phong | 1709. Penguin-Avia | 11 Apr 2013 23:01 | 2 |
Pls, anyone give me some hint about test #2 ! Thanks |
WA 8 | Squire [Lviv NU] | 1119. Metro | 11 Apr 2013 16:55 | 1 |
WA 8 Squire [Lviv NU] 11 Apr 2013 16:55 Guys, what is 8-th test? I have a lot of WA on it and i can't find out why. |
I really don't know that what's wrong with it. Give the fresh a hand .thank you.CE error. | ever_cc | 1001. Reverse Root | 11 Apr 2013 10:15 | 1 |
#include <stdio.h> #include<math.h> void main() { float a[1024]; int i=0,count=0;
do{ scanf("%f",&a[i]); i++; count=i-1; }while((a[count]>=0)&&(a[count]<=pow(float(10),18))); getchar(); for (i=count-1;i>=0;i--) printf("%.4f\n",sqrt((float)a[i])); } |
Why don't workng !!?!?!??!? | Daniel | 1902. Neo-Venice | 11 Apr 2013 03:24 | 3 |
#include<iostream> #include<cmath> #include<iomanip> using namespace std; int main() { double *a,*d; int n,t,s,i; float temp; cin>>n; if(n>=1 && n<=100) { cin>>t; if(t>=1 && t<=100) { cin>>s; if(s>= 360 && s<=1200) { a = new double[n]; d = new double[n]; for(i=0;i<n;i++) { cin>>a[i]; if(i==1) { if(a[i] <= a[i-1]) { return 0; } }
}
for(i=0;i<n;i++) { temp = t/n; if(s == a[i]) { d[i] = a[i]+temp; } else if(s < a[i]) { temp = temp/n; d[i] = a[i]+temp; }
} cout.setf(ios::showpoint); for(i=0;i<n;i++) { cout<<d[i]<<0<<0<<0<<endl; } } else { return 0; } return 0;} return 0;}
return 0; } First of all, you don't have to check if the input is correct, so the following lines are useless: if(n>=1 && n<=100) if(t>=1 && t<=100) if(s>= 360 && s<=1200) if(i==1) //this is wrong - I think the that the condition is i>=1 { if(a[i] <= a[i-1]){ return 0; } } Then, n has nothing to do with t. So temp=t/n is not ok. (try: 3 60 600 600 630 631 to see why). Imagine that you have 4 points: A,B,C,D. The distance (in time) between them is as it follows: B-A=s ,C-B=t, D-C=sn. So two gondolas that have the same speed, would meet in the point (A+D)/2. Also, you may want to check http://www.cplusplus.com/reference/ios/ios_base/precision/ to see how you can set the floating-point precision. That is (s+t+sn)/2. |
Sick Problem | Varun Sharma | 1607. Taxi | 10 Apr 2013 17:56 | 2 |
When I first saw this problem, I thought I would be done in 5 minutes but ended up spending 1 and 1/2 hours. Few test cases, so that you don't blow your head up ! Input: 4000 100 200 100 Output: 4000 Input: 150 400 1000 200 Output: 800 petr taxi 150 1000 550 800** 950 600 so in the example the answer is 800,not 950; but ** in test case no 1: petr taxi 150 1000 200 900 250 800 300 700 350 600 400 500 450** 400 the same set of sequence(rather similar)of event occurs with different answers... plz help with this mess..... Edited by author 10.04.2013 17:58 |
WA 5 | A.06 | 1900. Brainwashing Device | 10 Apr 2013 10:24 | 1 |
WA 5 A.06 10 Apr 2013 10:24 I am using DP O(n^2) time and getting WA 5. I have tried all the test cases listed here and my program outputs correct answer for all of them. If anyone has any examples, please respond, thank you. |