Show all threads Hide all threads Show all messages Hide all messages | Overrated | Keworker `~ | 1154. Mages Contest | 14 Aug 2024 13:02 | 1 | This task has some problems with accurancy, but 878 is too big rating for it. | Why the answer in the first example is 02:00:00 25.00? | Felix_Mate | 1154. Mages Contest | 2 Jul 2017 17:51 | 1 | When time is 02:00:00 Good have power=58 and Evil=60 ((x-40)/(130-40)=7200/36000 => x=58). | To admins! | ilya trofimov | 1154. Mages Contest | 8 Oct 2013 00:59 | 2 | “We can't win!” in English statement is not «We can’t win!» in Russian statement: ' not equal ’. Thus if you use ’ - WA8. | if get wa on test 2 | skyjiange | 1154. Mages Contest | 8 Nov 2011 14:32 | 1 | be careful with the input order,i thought it would be A E F W,but that's wrong. | IF you get WA 10 !!! | Akcium | 1154. Mages Contest | 20 Jan 2011 19:51 | 3 | with code like this if(lmastery-dmastery>maxdif) maxdif = lmastery - dmastery; i got WA 10 but with if(lmastery-dmastery>maxdif+1e-9) maxdif = lmastery - dmastery; i got AC I havn't rools for choosing right value eps=1e-9. Insread I use more 10 times already my unit for long arithmetics and have Ac. In this problem I used fraction of tipe LongA/longA. Of couse authors used flouts but my exact arithm and author's rounding floats correspond and it is very very surprisingly. Except for roudindg problem is very simple and dosn't demand any optimization for time and memory. | WA8 | r1d1 | 1154. Mages Contest | 3 Jan 2011 19:20 | 2 | WA8 r1d1 12 Apr 2010 03:53 I have WA8. Many authors also haved WA8. Anybody, help me! Re: WA8 [RSU_Tash]Shavkat_Khusanov 3 Jan 2011 19:20 I got WA8 too. Now AC. check it if Plights-Pdarkness<=0.0 then We can't win!!! if Plights-Pdarkness<0.0 then you will get WA8 Edited by author 03.01.2011 19:23 Edited by author 03.01.2011 19:24 | Which answer for this test? | VasilySlesarev | 1154. Mages Contest | 25 Sep 2010 19:56 | 4 | I have WA 7, write answer for this test, please A 01:00:01 100 12:12:02 20 E 10:10:01 12 01:02:02 2 F 00:00:00 110 23:00:02 100 W 00:10:01 56 00:00:02 12 AFWE AAEE My AC program gives: 12:12:02 107.85 Thank you! I have found a mistake. | What is with the damn 10 test? | Gheorghe Stefan | 1154. Mages Contest | 3 Feb 2010 01:26 | 5 | I got WA at test 10... I compared my source with an AC one and got same results on many tests... oh God I've wrote if (H == 13) H = M = S = 0 and got AC ! In test 10 you may have a precision problem. When comparing double values use some epsilon like 1e-9. It worked for me at least... I rewrote everything to long arithmetics and fair fractions, still WA10. The problem is that the answer is 00:00:00. I checked only control points (moments of power and weakness for all 4 forces), but if resulting function is minimal and constant on range [x2;24*60*60) U [0;x1), then the answer should be 0. Simply adding 0 to list of points to check gave me AC. I believe solution with 'double' type would also do it :) Edited by author 11.08.2008 08:58 Oh, thank you very much! I added zero to my check list and at last i have AC now too :) (I had WA #10 before it) | Be careful! | 2rf [Perm School #9] | 1154. Mages Contest | 8 Aug 2009 19:58 | 2 | In this problem, last line of input can end not with EOF but with just newline character. However, I read it like this: while ((c=getchar()) != EOF) kol[d[c]]--; and wasted about 20 submissons and 1,5 hours of time to find and fix it. | can anyone here tell me,what's the sample means? | zrp | 1154. Mages Contest | 21 Dec 2008 07:34 | 1 | | I got WA#2!!! Why? | Dembel {AESC USU} | 1154. Mages Contest | 13 Dec 2006 01:06 | 3 | I think I have right solution. But I have WA#2. Help me! Re: Dembel {AESC USU} 12 Dec 2006 23:35 input A 00:00:01 1 00:00:02 2 E 00:00:01 1 00:00:02 2 F 00:00:01 1 00:00:02 2 W 00:00:01 1 00:00:02 2 A A What output: We can't win! or 00:00:00 0.00 Edited by author 12.12.2006 23:36 Re: Re: Sandro (USU) 13 Dec 2006 01:06 My answer is "We can't win!" Good luck! | What is the answer for this test? | Samsonov Alex | 1154. Mages Contest | 29 Jul 2005 13:18 | 4 | E 00:00:00 1000 12:00:00 0 F 00:00:00 1000 12:00:00 0 W 12:00:00 1000 00:00:00 0 A 06:00:00 1000 00:00:00 0 AWAFE WA My program output: 00:46:15 2000.00 I think the answer should be like 06:00:00 2000.00 but it looks like my program output is correct. Is it? my AC yields 00:51:12 2000.00 i think answer should be 00:00:00 2000.0 Yep. Now I've got the same answer, but still WA2:( | Something may help you (+) | Yu Yuanming | 1154. Mages Contest | 6 Jun 2005 16:45 | 1 | When search will work, why not use it for a try? Search all the time from 00:00:00 to 23:59:59, you can easily got AC in 0.031sec...:) Also, there exist a algorithm use only O(1): Because all change in liner,the max ans must be in one of the 8 time. But take care that the "eariest" time may not be any of them, it can be an earier such as 00:00:00... | How does the sample output be that?Why? | kkkkk | 1154. Mages Contest | 9 Aug 2004 21:16 | 1 | | I think only 8 time can be considered. but i get WA test 10 i don't know why | test | 1154. Mages Contest | 19 Jul 2004 10:24 | 3 | But the first line of the answer to Test 10 is 00:00:00. At first I only did the 8 time.The same as you I got WA 10. Then I did all of the time from 00:00:00 to 23:59:59.To my surprise it only took 0.089 sec to get AC.At last I did 00:00:00 first ,then the 8 time,last 23:59:59.I got AC! Edited by author 13.05.2004 11:55 If at the earliest time of the 8 times and the latest one of the 8 Light can win by the same advantage, then you should output 00:00:00 -- that's actually the 'earliest' time. | I got WA on test2,who can give me any test datas? | Failed Peter | 1154. Mages Contest | 20 Apr 2004 20:18 | 1 | I think my method is right. | What is wrong with my code? | Koala | 1154. Mages Contest | 30 Apr 2003 18:14 | 2 | program p1154; const zero=1e-5; allday=24*60*60; maxnum=1e+16; var t:array [1..4,1..4] of longint; p:array [1..4,1..4] of real; g:array [1..2,1..4] of longint; now:array [1..4] of real; delta:array [1..4,1..3] of real; power:array [1..2] of real; pp,j,t1,t2,i,time,anstime,h,m,s:longint; p1,p2,ans,advantage:real; ch:char; function change(ch1,ch2:char):longint; begin change:=(ord(ch1)-ord('0'))*10+(ord(ch2)-ord('0')); end; procedure readdata(var t:longint; var p:real); var ch,ch1:char; h,m,s:longint; begin read(ch); while ch=' ' do read(ch); read(ch1); h:=change(ch,ch1); read(ch); read(ch); read(ch1); m:=change(ch,ch1); read(ch); read(ch); read(ch1); s:=change(ch,ch1); t:=h*3600+m*60+s; read(p); end; procedure print(a:longint); begin if a<10 then write(0); write(a); end; begin for pp:=1 to 4 do begin read(ch); j:=0; case ch of 'A': j:=1; 'E': j:=2; 'F': j:=3; 'W': j:=4; end; readdata(t1,p1); {Power} readdata(t2,p2); {Weakness} readln; if t1<t2 then begin t[j,1]:=t2-allday; p[j,1]:=p2; t[j,2]:=t1; p[j,2]:=p1; t[j,3]:=t2; p[j,3]:=p2; t[j,4]:=t1+allday; p[j,4]:=p1; end else begin t[j,1]:=t1-allday; p[j,1]:=p1; t[j,2]:=t2; p[j,2]:=p2; t[j,3]:=t1; p[j,3]:=p1; t[j,4]:=t2+allday; p[j,4]:=p2; end end; fillchar(g,sizeof(g),0); for i:=1 to 2 do begin while not eoln do begin read(ch); case ch of 'A': inc(g[i,1]); 'E': inc(g[i,2]); 'F': inc(g[i,3]); 'W': inc(g[i,4]); end; end; readln; end; for i:=1 to 4 do for j:=1 to 3 do delta[i,j]:=(p[i,j+1]-p[i,j])/(t[i,j+1]-t[i,j]); ans:=-maxnum; anstime:=0; for time:=0 to allday-1 do begin for i:=1 to 4 do for j:=1 to 3 do if (t[i,j]<time) and (time<=t[i,j+1]) then now[i]:=p[i,j]+delta[i,j]*(time-t[i,j]); for i:=1 to 2 do begin power[i]:=0; for j:=1 to 4 do power[i]:=power[i]+g[i,j]*now[j]; end; advantage:=power[1]-power[2]; if advantage>ans+zero then begin ans:=advantage; anstime:=time; end; end; if ans<0 then writeln('We can''t win!') else begin h:=anstime div 3600; m:=(anstime div 60) mod 60; s:=anstime mod 60; print(h); write(':'); print(m); write(':'); print(s); writeln; writeln(ans:0:2); end; end. const ch:array[1..4] of char=('A','E','F','W'); maxtime=24*60*60; e=1e-20; type elem=array[1..4] of longint; var a:elem; d,f:array[1..4,1..2] of longint; l,g:array[1..4] of longint; s:string; i,j,flag:longint; ans,x:extended; function find(k:char):integer; var i:integer; begin for i:=1 to 4 do if ch[i]=k then exit(i); end; function getch:char; var ch:char; begin read(ch); while ch=' ' do read(ch); getch:=ch; end; function getnext:longint; var now,i,x:longint; ch:char; begin now:=0; for i:=1 to 3 do begin ch:=getch; x:=ord(ch)-ord('0'); ch:=getch; x:=x*10+ord(ch)-ord('0'); now:=now+x; now:=now*60; if i<3 then ch:=getch; end; getnext:=now div 60; end; procedure readin; var ch:char; t,x,max,min,i:longint; begin read(ch); i:=find(ch); x:=getnext; read(max); f[i,1]:=x; x:=getnext; readln(min); f[i,2]:=x; if f[i,1]>f[i,2] then begin t:=f[i,1]; f[i,1]:=f[i,2]; f[i,2]:=t; d[i,1]:=min; d[i,2]:=max; g[i]:=(max-min); l[i]:=f[i,2]-f[i,1]; end else begin g[i]:=min-max; l[i]:=f[i,2]-f[i,1]; d[i,1]:=max; d[i,2]:=min; end; end; procedure print(k:longint); var x:longint; begin x:=k div 3600; if x<10 then write(0); write(x,':'); k:=k mod 3600; x:=k div 60; if x<10 then write(0); write(x,':'); k:=k mod 60; if k<10 then write(0); writeln(k); writeln(ans:0:2); end; function calc(k:longint):extended; var i,t:longint; ans,x:extended; begin ans:=0; for i:=1 to 4 do if a[i]<>0 then begin if (f[i,1]<=k) and (k<=f[i,2]) then x:=d[i,1]+(k-f[i,1])*g[i]/l[i] else begin if k>f[i,2] then t:=k-f[i,2] else t:=(maxtime-f[i,2])+k; x:=d[i,2]-t*g[i]/(maxtime-l[i]); end; ans:=ans+x*a[i]; end; calc:=ans; end; begin for i:=1 to 4 do readin; fillchar(a,sizeof(a),0); readln(s); for i:=1 to length(s) do inc(a[find(s[i])]); readln(s); for i:=1 to length(s) do dec(a[find(s[i])]); ans:=-1e20; for i:=1 to 4 do for j:=1 to 2 do begin x:=calc(f[i,j]); if (x>ans) or (x=ans) and (f[i,j]<flag) then begin ans:=x; flag:=f[i,j]; end; end; x:=calc(0); if x>ans then begin ans:=x; flag:=0; end; if ans<=e then writeln('We can''t win!') else print(flag); end. | What does the last two lines in input mean? What does | qaztz | 1154. Mages Contest | 23 Feb 2002 13:22 | 1 | | Why I get WA? Pelase, help me!!!!!!! | Nazarov Denis (nsc2001@rambler.ru) | 1154. Mages Contest | 8 Jan 2002 19:49 | 2 | My code: Program t1154;{$N+} Const Eps=1E-9; Type Mages=(A,E,F,W); Time=record H,Min,Sec :integer end; Var Info :array[Mages]of record TPower,TWeak :time; Power,Weak :integer; end; ch :char; S,Tmp :string[255]; L,D :array[Mages]of integer; CT,MinT :time; Per :array[1..9]of time; Max :extended; i,j,k,t :integer; Procedure GetTime(Str:string;Var T:Time); var i:integer; begin val(copy(str,1,2),T.H,i); val(copy(str,4,5),T.Min,i); val(copy(str,7,8),T.Sec,i); end; Function GetPower(TPower,TWeak,TCur:time;Power,Weak:integer):extended; var t0,t1,t2,t3,tc,t :extended; p0,p1,p2,p3,p :integer; begin t1:=TPower.H+TPower.Min/60+TPower.Sec/3600;p1:=Power; t2:=TWeak.H+TWeak.Min/60+TWeak.Sec/3600;p2:=Weak; tc:=TCur.H+TCur.Min/60+TCur.Sec/3600; if t1>t2 then begin t:=t1;t1:=t2;t2:=t; p:=p1;p1:=p2;p2:=p; end; t0:=t2-24;p0:=p2; t3:=t1+24;p3:=p1; if tc<t1 then t:=p0+(p1-p0)*((tc-t0)/(t1-t0)) else if tc<t2 then t:=p1+(p2-p1)*((tc-t1)/(t2-t1)) else if tc<t3 then t:=p2+(p3-p2)*((tc-t2)/(t3-t2)); GetPower:=t; end; Function GetMagesR(CTime:time):extended; var imp :array[mages]of extended; li,di :extended; begin imp[A]:=GetPower(Info[A].TPower,Info[A].TWeak,CTime,Info [A].Power,Info[A].Weak); imp[E]:=GetPower(Info[E].TPower,Info[E].TWeak,CTime,Info [E].Power,Info[E].Weak); imp[F]:=GetPower(Info[F].TPower,Info[F].TWeak,CTime,Info [F].Power,Info[F].Weak); imp[W]:=GetPower(Info[W].TPower,Info[W].TWeak,CTime,Info [W].Power,Info[W].Weak); li:=imp[A]*l[A]+imp[E]*l[E]+imp[F]*l[F]+imp[W]*l[W]; di:=imp[A]*d[A]+imp[E]*d[E]+imp[F]*d[F]+imp[W]*d[W]; GetMagesR:=li-di; end; begin for i:=1 to 4 do begin Readln(S); S:=S+' '; ch:=S[1]; for j:=2 to length(s) do if s[j]<>' ' then break; if ch='A' then GetTime(copy(s,j,8),Info[A].TPower); if ch='E' then GetTime(copy(s,j,8),Info[E].TPower); if ch='F' then GetTime(copy(s,j,8),Info[F].TPower); if ch='W' then GetTime(copy(s,j,8),Info[W].TPower); j:=j+8; for k:=j to length(s) do if s[k]<>' ' then break; Tmp:=''; while s[k]<>' ' do begin Tmp:=Tmp+s[k];k:=k+1; end; if ch='A' then Val(Tmp,Info[A].Power,t); if ch='E' then Val(Tmp,Info[E].Power,t); if ch='F' then Val(Tmp,Info[F].Power,t); if ch='W' then Val(Tmp,Info[W].Power,t); for j:=k to length(s) do if s[j]<>' ' then break; if ch='A' then GetTime(copy(s,j,8),Info[A].TWeak); if ch='E' then GetTime(copy(s,j,8),Info[E].TWeak); if ch='F' then GetTime(copy(s,j,8),Info[F].TWeak); if ch='W' then GetTime(copy(s,j,8),Info[W].TWeak); j:=j+8; for k:=j to length(s) do if s[k]<>' ' then break; Tmp:=''; while s[k]<>' ' do begin Tmp:=Tmp+s[k];k:=k+1; end; if ch='A' then Val(Tmp,Info[A].Weak,t); if ch='E' then Val(Tmp,Info[E].Weak,t); if ch='F' then Val(Tmp,Info[F].Weak,t); if ch='W' then Val(Tmp,Info[W].Weak,t); end; FillChar(L,SizeOf(L),0); FillChar(D,SizeOf(D),0); ch:=' '; While (ch<>#10)and(ch<>#13)and(ch<>#26) do begin read(ch); Case ch of 'A': Inc(L[A]); 'E': Inc(L[E]); 'F': Inc(L[F]); 'W': Inc(L[W]); end; end; read(ch); ch:=' '; While (ch<>#10)and(ch<>#13)and(ch<>#26) do begin read(ch); Case ch of 'A': Inc(D[A]); 'E': Inc(D[E]); 'F': Inc(D[F]); 'W': Inc(D[W]); end; end; read(ch); MinT.H:=0; MinT.Min:=0; MinT.Sec:=0; Max:=GetMagesR(MinT); per[1].H:=23; per[1].Min:=59; per[1].Sec:=59; per[2]:=Info[A].TPower; per[3]:=Info[E].TPower; per[4]:=Info[F].TPower; per[5]:=Info[W].TPower; per[6]:=Info[A].TWeak; per[7]:=Info[E].TWeak; per[8]:=Info[F].TWeak; per[9]:=Info[W].TWeak; for i:=1 t > My code: > > Program t1154;{$N+} > > Const Eps=1E-9; > > Type Mages=(A,E,F,W); > Time=record H,Min,Sec :integer end; > > Var Info :array[Mages]of record > TPower,TWeak :time; > Power,Weak :integer; > end; > ch :char; > S,Tmp :string[255]; > L,D :array[Mages]of integer; > CT,MinT :time; > Per :array[1..9]of time; > Max :extended; > i,j,k,t :integer; > > Procedure GetTime(Str:string;Var T:Time); > var i:integer; > begin > val(copy(str,1,2),T.H,i); > val(copy(str,4,5),T.Min,i); > val(copy(str,7,8),T.Sec,i); > end; > > Function GetPower (TPower,TWeak,TCur:time;Power,Weak:integer):extended; > var t0,t1,t2,t3,tc,t :extended; > p0,p1,p2,p3,p :integer; > begin > t1:=TPower.H+TPower.Min/60+TPower.Sec/3600;p1:=Power; > t2:=TWeak.H+TWeak.Min/60+TWeak.Sec/3600;p2:=Weak; > tc:=TCur.H+TCur.Min/60+TCur.Sec/3600; > if t1>t2 then begin > t:=t1;t1:=t2;t2:=t; > p:=p1;p1:=p2;p2:=p; > end; > t0:=t2-24;p0:=p2; > t3:=t1+24;p3:=p1; > if tc<t1 then > t:=p0+(p1-p0)*((tc-t0)/(t1-t0)) else > if tc<t2 then > t:=p1+(p2-p1)*((tc-t1)/(t2-t1)) else > if tc<t3 then > t:=p2+(p3-p2)*((tc-t2)/(t3-t2)); > GetPower:=t; > end; > > Function GetMagesR(CTime:time):extended; > var imp :array[mages]of extended; > li,di :extended; > begin > imp[A]:=GetPower(Info[A].TPower,Info[A].TWeak,CTime,Info > [A].Power,Info[A].Weak); > imp[E]:=GetPower(Info[E].TPower,Info[E].TWeak,CTime,Info > [E].Power,Info[E].Weak); > imp[F]:=GetPower(Info[F].TPower,Info[F].TWeak,CTime,Info > [F].Power,Info[F].Weak); > imp[W]:=GetPower(Info[W].TPower,Info[W].TWeak,CTime,Info > [W].Power,Info[W].Weak); > li:=imp[A]*l[A]+imp[E]*l[E]+imp[F]*l[F]+imp[W]*l[W]; > di:=imp[A]*d[A]+imp[E]*d[E]+imp[F]*d[F]+imp[W]*d[W]; > GetMagesR:=li-di; > end; > > begin > for i:=1 to 4 do begin > Readln(S); > S:=S+' '; > ch:=S[1]; > for j:=2 to length(s) do > if s[j]<>' ' then break; > if ch='A' then GetTime(copy(s,j,8),Info[A].TPower); > if ch='E' then GetTime(copy(s,j,8),Info[E].TPower); > if ch='F' then GetTime(copy(s,j,8),Info[F].TPower); > if ch='W' then GetTime(copy(s,j,8),Info[W].TPower); > j:=j+8; > for k:=j to length(s) do > if s[k]<>' ' then break; > Tmp:=''; > while s[k]<>' ' do begin Tmp:=Tmp+s[k];k:=k+1; end; > if ch='A' then Val(Tmp,Info[A].Power,t); > if ch='E' then Val(Tmp,Info[E].Power,t); > if ch='F' then Val(Tmp,Info[F].Power,t); > if ch='W' then Val(Tmp,Info[W].Power,t); > for j:=k to length(s) do > if s[j]<>' ' then break; > if ch='A' then GetTime(copy(s,j,8),Info[A].TWeak); > if ch='E' then GetTime(copy(s,j,8),Info[E].TWeak); > if ch='F' then GetTime(copy(s,j,8),Info[F].TWeak); > if ch='W' then GetTime(copy(s,j,8),Info[W].TWeak); > j:=j+8; > for k:=j to length(s) do > if s[k]<>' ' then break; > Tmp:=''; > while s[k]<>' ' do begin Tmp:=Tmp+s[k];k:=k+1; end; > if ch='A' then Val(Tmp,Info[A].Weak,t); > if ch='E' then Val(Tmp,Info[E].Weak,t); > if ch='F' | Someone said that in this problem there are only 10 time can be considered: | New OIer | 1154. Mages Contest | 20 Dec 2001 17:35 | 3 | there are the 8 time that input data tells us the other 2 is 00:00:00 & 23:59:59 Why? Hardier 20 Dec 2001 17:35 >BTW,what's your E-mail address? mine is : hardier@sina.com |
|
|