| Show all threads Hide all threads Show all messages Hide all messages |
| Why time limit exceeded | Arsenal911 (Samara) | 1726. Visits | 5 Aug 2012 07:33 | 3 |
Why time limit exceeded on test#9? Maybe you use O(n^2) algo? You can do it in linear time. |
| WA7 | Peca | 1080. Map Coloring | 4 Aug 2012 20:49 | 1 |
WA7 Peca 4 Aug 2012 20:49 Does someone knows what is the 7th test? Than you very much! |
| Here's Solution | Meirambek | 1196. History Exam | 4 Aug 2012 15:27 | 1 |
//Solution By Omyrzak Meirambek #include <iostream> #include <fstream> #include <cstdio> #include <math.h> #include <queue> #include <stack> #include <set> #include <string> #include <utility> #include <cstdlib> #include <algorithm> #include <ctime> #include <vector> #include <map> using namespace std; #define fname "" #define ull unsigned long long #define ll long long #define INF 1000*1000*1000 const int N = 20000; map <int, int> q; int n, x, res = 0, m; int main () { #ifndef ONLINE_JUDGE freopen ("in","r",stdin); freopen ("out","w",stdout); #endif cin >> n; for (int i = 1; i <= n; i ++ ) { cin >> x; q[x] = 1; } cin >> m; for (int i = 1; i <= m; i ++ ) { cin >> x; res += q[x]; }
cout << res; return 0; } |
| wa#14 WHO CAN HELP ME??? PLEASE GUYS!!! | New York Team | 1759. Long-Livers | 4 Aug 2012 13:37 | 1 |
Edited by author 04.08.2012 18:24 |
| floyd-warshall or Dijkstra? | Sergey Zuev (LYC) | 1085. Meeting | 4 Aug 2012 02:38 | 6 |
Should I use Dijkstra's algorithm several times for each friend or just floyd-warshall? ..? good q .. but .. ! all the edge's cost's are 1 .. so .. :-) use BFS .. for every friend from its starting position :-) its n*k :-) .. but i got WA 14 :-( ... ~~~~~~~~~~~~~~~~~~~~~~~~~~~ now i get it .. the WA's in the discuss are very useful :-) and .. with my o(n*k) i had .. 0.031 264 KB Edited by author 13.09.2010 22:03 Edited by author 13.09.2010 22:03 Are you sure it's O(n*k)? I used DFS from every tramstop to find how much it costs for all of friends to meet here. This test helped me a lot (it's funny to draw circles): 13 5 3 1 2 3 3 4 5 3 3 6 7 3 3 8 9 3 8 10 4 11 6 12 8 13 1 I corrected all mistakes by adding different situations on this tram-map :) |
| WA25, help me please | Artyom Averin [Psych Up club] | 1884. Way to the University | 4 Aug 2012 00:41 | 1 |
Please help me, guys, I don't know what's the problem:( #include <iostream> using namespace std; int lft[320], rght[320]; double timeleft[320], timeright[320]; double const eps = 0.0000001; int main(){ int n,m; cin >> n; for(int i = 1; i <= n; i++){ cin >> lft[i]; timeleft[i] = (lft[i] + 5.000)*9/50; } cin >> m; for(int i = 1; i <= m; i++){ cin >> rght[i]; timeright[i] = (rght[i]+5.000)*9/50 - 36.000/25; } double ans = 1000000000; if(lft[1] >= 8 && (rght[1] >= 16 || (rght[1] <= 3 && (rght[2] >= 16 || m == 1)))){ cout << 0; return 0; } for(int i = 1; i <= n; i++){ double cur = timeleft[i]; bool b = 0; if(lft[i+1] - lft[i] >= 13 || lft[i+1] == 0){ for(int j = 1; j <= n; j++){ double temp = rght[j] - (cur + 36.000/25)*200.000/36; if(temp > -5 + eps && temp + eps < 8) b = 1; } } else b = 1; if(!b && cur + eps < ans) ans = cur; } for(int i = 1; i <= m; i++){ double cur = timeright[i]; bool b = 0; if(rght[i+1] - rght[i] >= 13 || rght[i+1] == 0){ for(int j = 1; j <= n; j++){ double temp = lft[j] - cur*200.000/36; if(temp - eps > -5 && temp + eps < 8) b = 1; } } else b = 1; if(!b && cur + eps < ans) ans = cur; } printf("%.9f",ans); return 0; } |
| WA24 (hint) | MOPDOBOPOT (USU) | 1088. Ilya Murometz | 3 Aug 2012 18:29 | 1 |
Don't forget cases when Ilya and Alesha are on same way (from root to berth). In my solution lca of positions could be less than they was :) For example: 4 4 4 1 2 0 output: YES 4 2 4 7 7 2 output: YES Edited by author 03.08.2012 18:32 |
| Hello. What about test 15? Can you give it? | Alexander Goncharov | 1571. Interpreters | 3 Aug 2012 16:15 | 1 |
Hello. What about test 15? Can you give it? |
| compile error | Tianma | | 3 Aug 2012 15:56 | 1 |
Why I can compile by gcc (UBUNTU),but I always make mistakes here? |
| Why its name is "Гигантский мезон с вишнями"? | Alexey Dergunov [Samara SAU] | 1852. Cube in a Cube in a Cube | 3 Aug 2012 11:46 | 2 |
|
| Please AC's people come in. | wcwswswws | 1489. Points on a Parallelepiped | 2 Aug 2012 23:13 | 4 |
Can you tell me why I am wrong in test 2 if you was wrong in test2 once? I have got WA2, because I had incorrect region checking (I used only x or y coordinate). When I used x and y I got AC. e.g. checking of bottom region is: if (b+c<=y && y<=b+c+b && c <= x && x<=c+a) Check variant, when points situated on one border!!! Olympic Bear, I had same problem and your method rocks! :D Edited by author 02.08.2012 23:28 |
| wa on 6 test!!! | Artem Ladik | 1364. LaraKiller | 2 Aug 2012 16:36 | 3 |
check some tests input 5 5 1 5 1 3 0 output 1 3 input 5 5 1 5 1 3 10000000 output 1 1 1 2 1 3 1 4 1 5 input 100 100 51 50 1 1 1000000 output 1 1 1 2 ... 51 51 51 50 #10000 points input 2 100 2 1 1 1 100000 output 1 1 1 2 ... 1 99 1 100 2 100 2 99 ... 2 2 2 1 #200 points Just check more carefully borders you print! For example (Lara's position - T) can be less or equal to zero. Try this test: 2 2 2 1 2 1 4 |
| Test 6 | Fyodor Menshikov | 1438. Time Limit Exceeded | 2 Aug 2012 16:07 | 3 |
Test 6 Fyodor Menshikov 24 Dec 2008 22:26 The first test where token != used. And the first test where the program flow ends not by 'end' command. Like here: a = 1 <no end command here> My program works perfectly on any of my tests, on any tests from this task's discussion, even if there is no 'end' command and if there is "!=" token, but i got WA#6. Is in this test anything unusual or wrong? Should I, for example, add an 'end' command, as Ludovic did? http://acm.timus.ru/forum/thread.aspx?id=13124&upd=632835406669279530 And about limit of commands of 10_000_000 : "The if ... goto command works just as the goto command if the condition after if is true". Should I count an "if..goto" command, if condition was wrong? I just have no ideas, what can be wrong in my algo. Sorry for my bad English. |
| WA1 ??? | Hi4ko | 1796. Amusement Park | 2 Aug 2012 16:04 | 2 |
why is it so? #include <iostream> #include <cmath> using namespace std; int main() { int value[]={ 10, 50, 100, 500, 1000, 5000 }; int num[5],sum=0; int price; for(int i=0;i<6;i++) { cin>>num[i]; sum+=num[i]*value[i]; } cin>>price; int i=0; while(num[i]==0) ++i; int lol=0,lol1=0; while(lol*price<=sum-value[i]) ++lol; int j=0; int k=0; while((lol+k)*price<=sum) { ++lol1; ++k; } cout<<lol1<<endl; while((lol+j)*price<=sum) { cout<<lol+j<<" "; ++j; } } #include <iostream> #include <cmath> using namespace std; int main() { int value[]={ 10, 50, 100, 500, 1000, 5000 }; int num[5],sum=0; int price; for(int i=0;i<6;i++) { cin>>num[i]; sum+=num[i]*value[i]; } cin>>price; int i=0; while(num[i]==0) ++i; int lol=0,lol1=0; while(lol*price<=sum-value[i]) ++lol; int j=0; int k=0; while((lol+k)*price<=sum) { ++lol1; ++k; } cout<<lol1<<endl; while( i < lol1 ) { cout << lol + j << " "; j++; i++; } cout << lol + j << endl; } |
| Погрешность | MegaFPyKT | 1885. Passenger Comfort | 2 Aug 2012 11:24 | 3 |
Почему написано погрешность не должна превосходить 10е−6, при том что в примере выводят с точностью в 10е-1? И при какой скорости закладывает уши? Больше х это х+10е-6, или может это не учитывать? Edited by author 29.10.2011 15:28 Stigius you're the smartest I can see |
| WA1 HINT | MOPDOBOPOT (USU) | 1027. D++ Again | 1 Aug 2012 17:34 | 1 |
WA1 HINT MOPDOBOPOT (USU) 1 Aug 2012 17:34 If you have WA1 just skip all #10 and #13 symbols from input data! |
| Please, Help me! WA on #5 | sergey2105 | 1025. Democracy in Danger | 1 Aug 2012 06:47 | 1 |
import java.util.Scanner; public class Main { public static void main(String args[]) { try { Scanner in = new Scanner(System.in);
int[] group = new int[in.nextInt()]; for(int i=0; i<group.length; i++) { group[i] = in.nextInt(); } int per; for(int i=0; i<group.length - 1; i++) { for(int j=1; j<group.length; j++) { if (group[i] >= group[j]) { per = group[i]; group[i] = group[j]; group[j] = per; } } } int sum = 0; for(int i=0; i<group.length/2 + 1; i++) { sum += group[i]/2 + 1; } System.out.println(sum); in.close(); } catch(Exception e) { System.out.println("Error"); } } } |
| help | Dima | 1821. Biathlon | 1 Aug 2012 04:49 | 2 |
help Dima 1 Aug 2012 04:48 var n,i,a,j,m:integer;q:string;b:real; s:array[1..1000]of string; begin readln(n); b:=99999999999; m:=0; for i:=1 to n do begin readln(q); for j:=1 to length(q) do if q[j]=' ' then a:=j; if (((ord(q[a+1])-48)*10+(ord(q[a+2])-48))*60+((ord(q[a+4])-48)*10+(ord(q[a+5])-48))+(ord(q[a+7])-48)/10<b) then begin inc(m); s[i]:=copy(q,1,a-1); b:=((ord(q[a+1])-48)*10+(ord(q[a+2])-48))*60+((ord(q[a+4])-48)*10+(ord(q[a+5])-48))+(ord(q[a+7])-48)/10; end; end; for i:=1 to n do for j:=1 to n-1 do if s[j]>s[j+1]then begin q:=s[j];s[j]:=s[j+1];s[j+1]:=q; end; writeln(m); for i:=1 to n do if s[i]<>'' then writeln(s[i]); end. |
| TL on test 2; O( (n-m)*log m ), is O(n logm) slow ? | cs_Diablo | 1126. Magnetic Storms | 31 Jul 2012 21:06 | 3 |
I'm calculating for every interval the max element with binary indexed tree in log(n) time. But still got TL on test 2. Is it ok NlogM to be slow ? It can be solved in O(NM), TLE is too big. Once my friend did it :) I think there's a bug in your implementation. Are you sure that (build a tree on i-th step) + (find element) works in O(NlogM)? I used two stacks (they works like queue) with access to max element in O(1) (something like 3 operations on each element). So it can be solved in O(n)! |
| HINT! Memory should be above 25000 but 14000 , I got crash because of it :( | vongang | 1126. Magnetic Storms | 31 Jul 2012 21:00 | 2 |
Edited by author 20.11.2011 15:23 |