Common BoardWhat numbers could be in test 5? Everything is right. Why it doesn't accepted... Сомневаюсь, что кто-то ответит, но мало ли Ну же... Хоть кто нибудь Спать не могу substract one from every element of sequence and search for prefix or suffix (I mean subsequence A_0, A_1, ..., A_j or A_k, A_{k+1}, ..., A_s) with negative sum. I don't understand why it show me a Runtime error (access violation) when it s compiling and it works perfectly in my computer ??? Can you share your code please? There can be many reasons for this behavior. Try to define a bigger array! from math import sqrt f=list((int(x) for x in input().split())) f.reverse() j=list((sqrt(x) for x in f)) for x in j: print('%.4f'%x) i find it it's need replace input() with sys.stdin.read() from math import sqrt import sys f=list((int(x) for x in sys.stdin.read().split())) f.reverse() j=list((sqrt(x) for x in f)) for x in j: print('%.4f'%x) What programming language are you using? What's Test 9? My algo is: Search the segment with more intersections and delete it (repeat while the segment got 0 intersections) Is it wrong? yes it is wrong 7 1 3 2 5 2 5 4 7 6 9 6 9 8 10 tanx... Edited by author 07.11.2008 21:32 "a <= b" -> "a < b+eps" "a < b" -> "a < b-eps" eps = 1e-8 was enough for this prolem I use you hint... but I got wa#16 :( Some tests 10 10 1 9 6 NO 10 10 1 9 7 YES Can you explain why the second answer is YES. Need it badly #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); //... 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 конюшне и считаем заново все варианты заполнения уже для неё 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 I found my mistake. I have AC. Edited by author 12.12.2010 15:33 What was the problem? Test TTGgtAatTGgt 1 6 11 turned out to be helpful. 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"){ // ... 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 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; } 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 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 Can you give me a test similar to the fifth test. Just i dont know where i have endless cycle? Sorry for my english. Why? My code works correctly when it is no "end" in the end and with != qayerda xato qildim ko`zinga achke taqib qara Yaxshilab o`qi va yana o`qi ok? |
|