Common Board| Show all threads Hide all threads Show all messages Hide all messages | | cin/cout in 0.312s | ASK | 1107. Warehouse Problem | 21 Mar 2014 17:01 | 1 | #define I(x) int x; cin >> x #define F(i,n) for(int i = 0; i < (n); ++i) int main(){ cin.sync_with_stdio(false); I(n); I(k); I(m); cout << "YES" << endl; F(i,k){ I(s); F(i,s){ I(x); //... | | Some hint | svg2003 | 1167. Bicolored Horses | 21 Mar 2014 05:53 | 1 | 1. Инициализация Начинайте с 1 конюшни Пусть нам надо поставить туда I лошадей (I = 1..N) Коэффициент несчастья для I лошадей будет при этом равен White * Black для Horses = 0..i По итогу этого у нас будут оптимальные (потому что единственные) коэффициенты для всех лошадей в случае 1 конюшни 2. Итерации (меняем J-ую конюшню) Надо рассчитать минимальный коэффициент несчастья если в 1..J конюшни поставить I лошадей Для этого переберём все варианты, поставив в J конюшню K лошадей (K = 1..I лошади) и оптимально заполнив первые J-1 конюшни I-K лошадьми (этот коэффициент у нас уже рассчитан на предыдущем шаге итерации) Перебрав все варианты у нас получится оптимальное заполнение первых J конюшен первыми I лошадьми Переходим к J + 1 конюшне и считаем заново все варианты заполнения уже для неё | | explain recent rejudge? | Vyacheslav Kim | 1389. Roadworks | 21 Mar 2014 02:40 | 2 | Hi, I had an accepted solution 3 years ago and now I have no idea what was wrong/right. Looking at my previous solution that now gets TLE, it was Kuhn matching algorithm. Did the constraints change or did you just add better tests? OK, I have no idea how could I possibly come up with such solution and how come it passed the tests before :P | | Wa22... | [RSU_Tash]Shavkat_Khusanov | 1724. Origin of Man Clarified | 20 Mar 2014 13:07 | 3 | Wa22... [RSU_Tash]Shavkat_Khusanov 12 Dec 2010 00:39 I found my mistake. I have AC. Edited by author 12.12.2010 15:33 Test TTGgtAatTGgt 1 6 11 turned out to be helpful. | | statement | Vit Demidenko | 1738. Computer Security | 20 Mar 2014 07:29 | 1 | | | cin/cout is possible | ASK | 1992. CVS | 19 Mar 2014 16:32 | 1 | I got AC with #define I(x) int x; cin >> x #define F(i,n) for(int i = 0; i < (n); ++i) int main(){ cin.sync_with_stdio(false); I(n); I(m); F(i,n){ string w; cin >> w; I(j); auto& c = clones[j-1]; if(w == "learn"){ // ... | | Tests | wRabbits_AlMag(VNTU) | 1710. Boris, You Are Wrong! | 19 Mar 2014 16:25 | 3 | Tests wRabbits_AlMag(VNTU) 27 Jul 2011 16:30 For wa#3: 4 0 0 3 0 0 YES For wa#4 0 0 5 0 6 5 YES For wa#5 0 0 4 0 2 3 The possible answer is: NO 0.00000000000000000000 0.00000000000000000000 4.00000000000000000000 0.00000000000000000000 0.46153846153846145000 0.69230769230769285000 But i still have have wa#31. I think, I have problem with precision. Can anyone tell me how to avoid this problem? UPD: Finaly AC. I think, it realy was a problem with precision, but I am not sure. Edited by author 27.07.2011 22:20 Edited by author 27.07.2011 23:58 Yes, problem in precision. EPS = 1e-10 AC EPS = 1e-11 WA#36 | | Visual C++ 2010, Runtime error (access violation) | Mario Pavlov | 1001. Reverse Root | 18 Mar 2014 22:49 | 2 | Could someone help me ? #include <iostream> #include <iomanip> using namespace std; int main() { double outputNumbers[100000]; double number; int index; index = -1; while (cin.fail() == false) { cin >> outputNumbers[++index]; }
cout << fixed; cout << setprecision(4);
while (index > 0) { cout << sqrt(outputNumbers[--index]) << endl; } return 0; } I have rewrite the program, using vectors but now I receive wrong answer... #include <iostream> #include <iomanip> #include <vector> using namespace std; int main() { vector<double> myVector; double value; while (cin.fail() == false) { cin >> value; myVector.push_back(sqrt(value)); }
myVector.pop_back(); cout << fixed; cout << setprecision(4); for (int i = 0; i < myVector.size(); i++) { cout << myVector[i] << endl; } return 0; } | | Why I get WA? Pelase, help me!!!!!!! | Revenger and NSC | 1127. Colored Bricks | 18 Mar 2014 22:36 | 4 | My program: Program t1127; Const P:array[1..24,1..6]of integer= {all combinations} ( (6,4,3,1,5,2), (3,5,4,1,6,2), (4,6,5,1,3,2), (5,3,6,1,4,2), (6,4,5,2,3,1), (3,5,6,2,4,1), (4,6,3,2,5,1), (5,3,4,2,6,1), (1,2,6,3,4,5), (6,4,2,3,1,5), (2,1,4,3,6,5), (4,6,1,3,2,5), (1,2,4,5,6,3), (6,4,1,5,2,3), (2,1,6,5,4,3), (4,6,2,5,1,3), (1,2,3,4,5,6), (3,5,2,4,1,6), (2,1,5,4,3,6), (5,3,1,4,2,6), (1,2,5,6,3,4), (3,5,1,6,2,4), (2,1,3,6,5,4), (5,3,2,6,1,4) ); MaxN=1000; Var Cube :array[1..MaxN,1..6]of char; Tmp :array[1..6]of char; ACube :array[1..MaxN,1..24]of string[4]; yet :array[1..MaxN,1..24]of boolean; N,i,j,k :integer; max,ik,jk :integer; m :integer; ch :char; begin Read(n); for i:=1 to N do for j:=1 to 6 do begin read(ch); while (ch=#10)or(ch=#13)or(ch=#32) do read(ch); Cube[i,j]:=ch; end; for i:=1 to N do for j:=1 to 24 do begin for k:=1 to 6 do tmp[k]:=cube[i,p[j,k]]; ACube[i,j]:=''; ACube[i,j]:=tmp[1]+tmp[2]+tmp[3]+tmp[4]; end; m:=0; for i:=1 to N do for j:=1 to 24 do yet[i,j]:=true; for i:=1 to N do for j:=1 to 24 do if yet[i,j] then begin yet[i,j]:=false; max:=1; for ik:=1 to N do if ik<>i then for jk:=1 to 24 do if ((acube[i,j][1]=acube[ik,jk][1])and(acube[i,j][4]=acube[ik,jk] [4]))or ((acube[i,j][1]=acube[ik,jk][4])and(acube[i,j][4]=acube[ik,jk] [1])) then if ((acube[i,j][2]=acube[ik,jk][2])and(acube[i,j][3]=acube[ik,jk] [3]))or ((acube[i,j][2]=acube[ik,jk][3])and(acube[i,j][3]=acube[ik,jk] [2])) then begin yet[ik,jk]:=false; max:=max+1; break; end; if max>m then m:=max; end; writeln(m); end. Think there are more combinations, i did solve this problem, but i don't remind how much, if you want write me :), miguelangelhdz@hotmail.com Good Luck > Think there are more combinations, i did solve this problem, but i > don't remind how much, if you want write me :), > miguelangelhdz@hotmail.com > Good Luck | | AC Code | ... | 1881. Long problem statement | 18 Mar 2014 14:37 | 1 | import java.util.Scanner; public class Problem_1881 { public static void main(String[] args) { Scanner in=new Scanner(System.in); int h,w,n,i,p,ans,SL,h1; ans=SL=h1=0; p=-1; ..... Edited by author 22.03.2014 20:32 | | endless cycle | aprogrom (MUCTR) | 1378. Artificial Intelligence | 18 Mar 2014 03:01 | 1 | Can you give me a test similar to the fifth test. Just i dont know where i have endless cycle? Sorry for my english. | | WA Test 6 | Mikle | 1438. Time Limit Exceeded | 18 Mar 2014 01:37 | 1 | Why? My code works correctly when it is no "end" in the end and with != | | salom | Akbar | 1785. Lost in Localization | 18 Mar 2014 01:16 | 3 | salom Akbar 12 Dec 2011 22:42 Re: salom xudaynazarov islom 8 Feb 2012 16:56 ko`zinga achke taqib qara Yaxshilab o`qi va yana o`qi ok? | | HelpPlease (Java) | Testme | 1821. Biathlon | 18 Mar 2014 00:37 | 1 | What is wrong with mycode? it is working in mycomputer but failing in test2 import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; /** * Created by sherxon on 3/17/14. */ public class Biathlon { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=Integer.parseInt(in.nextLine()); String s, name, time; Double min, sec; int j=0; List<String> a= new ArrayList(); ArrayList<Double> b= new ArrayList(); int thirty=0; for (int i = 0; i <n ; i++) { s = in.nextLine(); name=s.split(" ")[0]; sec=Double.parseDouble(s.split(" ")[1].split(":")[1])+60*(Double.parseDouble(s.split(" ")[1].split(":")[0])); sec+=thirty; //System.out.println(sec); double eachsec=0.0; double eachsecs=0.0; boolean bl=true; for (int k = 0; k<a.size() ; k++) { // System.out.println(sec-thirty + " " + (b.get(k)-eachsec) + " " +(sec) + " " + b.get(k)); if(sec-thirty<b.get(k)-eachsec&&sec<b.get(k)){ b.remove(k); a.remove(k); k--; } eachsec+=30; } for (int k = 0; k <a.size() ; k++) { if(sec-thirty>b.get(k)-eachsecs){ bl=false; } eachsecs+=30; } if(bl){ a.add(name); b.add(sec); } thirty+=30; } Collections.sort(a); System.out.println(a.size()); for (int i = 0; i <a.size() ; i++) { System.out.println(a.get(i)); } } } | | Names of variables | Mikle | 1438. Time Limit Exceeded | 17 Mar 2014 23:54 | 1 | Can variables have names "or", "and", "xor", "not", "print", "if", "goto", "end"? | | WA#1 | mtest1 | 1155. Troubleduons | 17 Mar 2014 15:54 | 1 | WA#1 mtest1 17 Mar 2014 15:54 Why for test 1 0 1 0 3 1 0 0 answer EF- AE- DH+ CD- EH- is wrong? | | When soultion does not exist? | Georgiy Savchenko | 1229. Strong Brickwork | 17 Mar 2014 15:02 | 3 | Could someone publish such testcase with the answer = -1? Edited by author 25.07.2008 18:11 If m and n are even, there is always a solution. | | I've got TL#1.Is the Test#1 so difficult? | cpc | 1004. Sightseeing Trip | 17 Mar 2014 04:59 | 15 | I have the same problem and I don't know why. If somebody know this test or some other like that, please show it. I supose that there is only one test... But all what you need is delete one road between 2 points and with help of Deikstra find out the shortest way between this points ... than add length of road and you find out the shortest way throw this row.... and so on! I solved this problem such way! It's O(N^4)! You can optimize this nice idea to reach O(N^3)! here is test 1: 4 6 1 2 40 1 3 50 1 40 60 2 3 10 2 4 30 3 4 20 one answer: 2 3 4 Edited by author 21.10.2005 16:50 Thanks for your test... :) I have AC 0.046 sec... but this problem says: "...In the town there are N crossing points numbered from 1 to N..." here is test 1: 4 6 1 2 40 1 3 50 1 40 60 2 3 10 2 4 30 3 4 20 one answer: 2 3 4 My program prints: 2 4 3 It's true, imho. I think It's : 1 2 40 1 3 50 1 4 60 2 3 10 2 4 30 3 4 20 my ans is 2 3 4,but get WA at Test#1 Impossible. I get 2 3 4 as answer at get wrong answer on #1 Floyd Algrathm is also advisable. However, please take note of another test: 4 4 1 2 10 2 3 1 3 4 1 4 1 1 should output things like 1 4 3 2 but NOT 1 4 3 4 | | To Judges | Mihai Calancea | 1619. Big Brother | 15 Mar 2014 07:43 | 1 | So I've made an embarrassingly large number of submissions for this problem. Thing is I submitted in C++ 11 and got WA 1. Afterwards I switched to Visual C++/G++ and got WA 2. Apparently this was caused by asserts that I had left in my program to check if test 1 is actually the example. After I removed them I got Accepted, but still WA 1 in C++11. So my questions would be: 1. Why did it get WA in C++ 11? 2. Why didn't the assert crash the program? | | Why this code on java does'n work/Почему код на java не работает(не проходит проверку) | Big_Brother | 1877. Bicycle Codes | 14 Mar 2014 13:33 | 3 | import java.util.Scanner; public class BicycleCode{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int firstCode = sc.nextInt(); int secondeCode = sc.nextInt();
if(firstCode%2==0 && secondeCode%2!=0){ System.out.println("yes"); }else if(firstCode%2!=0 && secondeCode%2==0){ System.out.println("no"); } } } the correct code: import java.util.Scanner; public class BicycleCode{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int firstCode = sc.nextInt(); int secondeCode = sc.nextInt(); if(firstCode%2==0 || secondeCode%2!=0){ System.out.println("yes"); }else if(firstCode%2!=0 || secondeCode%2==0){ System.out.println("no"); } } 1 Edited by author 14.03.2014 13:34 |
|
|