| Show all threads Hide all threads Show all messages Hide all messages |
| test 8 | Ehsan Goharshady | 1183. Brackets Sequence | 18 Aug 2014 17:49 | 1 |
test 8 Ehsan Goharshady 18 Aug 2014 17:49 Can anyone give me test 8 please? I don't what's wrong with my code. Thanks |
| for WA7 on Java | gio_gio | 1205. By the Underground or by Foot? | 18 Aug 2014 13:52 | 2 |
Read with BufferedReader not with StreamTokenizer. This was only mistake for me for > 100 tries :) |
| help me WA20 | Sunnat | 1592. Chinese Watches | 18 Aug 2014 02:26 | 2 |
Edited by author 07.06.2012 16:51 |
| Wrong Answer Test #1 (C++) | Anonymous | 1001. Reverse Root | 17 Aug 2014 22:47 | 2 |
Can anyone tell me what's wrong with the code? I have tested it for many times, and it works completely fine. But the online judge keeps telling me wrong answer. Code: #include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { double a[128]; double tmp = 0; int cnt = 0;
while(!cin.eof()) { cin >> a[cnt]; cnt += 1; } cout << setprecision(4) << fixed; for(int i = cnt - 1;i >= 0;i -= 1) { tmp = sqrt(a[i]); cout << tmp << endl; } return 0; } dont use cin.eof(), acm.timus cant check that, just use while(cin>>a[cnt]) |
| Problem 1014 "Product of Digits" has been rejudged | Vladimir Yakovlev (USU) | 1014. Product of Digits | 17 Aug 2014 22:31 | 3 |
New tests have been added. All accepted solutions have been rejudged. 886 authors have lost AC. such a fool i was 5 years ago... and test is so simple :) |
| What can be wrong here? | Igor | 1011. Conductors | 17 Aug 2014 20:44 | 1 |
Submitted following solution, but WA on 1st test. I tried very different inputs and works fine actually. def get_input_number gets.chomp.to_f end def calculate_conductors(low_percent, high_percent) (2..10000).each do |citizens| konduktors = (low_percent*citizens).ceil if (low_percent*citizens < konduktors) && (konduktors < high_percent*citizens) return citizens end end end def prepare_input_and_go lower_border = get_input_number/100 upper_border = get_input_number/100 puts calculate_conductors(lower_border, upper_border) end prepare_input_and_go |
| Why wrong?? C++ It's ok on my Dev c++.. | Alexander | 1001. Reverse Root | 17 Aug 2014 12:20 | 2 |
#include<stdio.h> #include<cmath> #include<vector> using namespace std; vector <double> v; int main() { double c; while(scanf("%lf",&c) != EOF) v.push_back(c);
for(vector <double>::iterator it=v.begin(); it != v.end(); it++) printf("%.4lf\n",sqrt(*it)); } may be > for(vector <double>::reverse_iterator it=v.rbegin(); it != v.rend(); it++) > printf("%.4lf\n",sqrt(*it)); ? |
| WA 11 Why? | SerCe | 1823. Ideal Gas | 15 Aug 2014 21:45 | 5 |
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <stdio.h> #include <cmath> using namespace std; int p=0,n=0,V=0,T=0; char c; int a=0,b=0,c1=0,d=0; double R=8.314; int main() { for(int i = 0; i < 3; i++) { cin >> c; if(c=='p') { cin >> c; cin >> p; a++; } if(c=='n') { cin >> c; cin >> n; b++; } if(c=='V') { cin >> c; cin >> V; c1++; } if(c=='T') { cin >> c; cin >> T; d++; } } if(a==0) cout << "p = " << R*n*T/V; if(b==0) cout << "n = " << p*V/(R*T); if(c1==0) { if(p==0 && n==0) { cout << "undefined"; return 0; } if(p==0 || n==0) { cout << "error"; return 0; } cout << "V = " << R*n*T/p; } if(d==0) { if(p==0 && n==0) { cout << "undefined"; return 0; } if(p==0 || n==0) { cout << "error"; return 0; } cout << "T = " << p*V/(R*n); } return 0; } Так же было и на самом контесте WA 11, сейчас тоже WA 11, хотя на разборе говорили все тоже самое Edited by author 20.03.2011 13:07 Edited by author 20.03.2011 13:07 Write something like this printf("n = %0.7Lf",rez); and be sure that you don't have any cout<<. I don't know the reason, this was my "mistake" and produced many WA :( Edited by author 14.07.2011 17:56 You can also write with setprecision. I think you have to output at least 3 decimals but I'm not sure. You must use fixed setprecision at least with 5 decimals: cout << fixed << setprecision(5); |
| Test 12 | [RISE] Levon Oganesyan [RAU] | 1823. Ideal Gas | 15 Aug 2014 21:23 | 1 |
Test 12 [RISE] Levon Oganesyan [RAU] 15 Aug 2014 21:23 in 12 test answer is p = 0. I write in my code "0" instead of "p = 0" and have WA12. Good Luck! |
| O(N) | sloboz | 1297. Palindrome | 14 Aug 2014 19:04 | 15 |
O(N) sloboz 13 Apr 2004 05:57 this can be done very cool in O(N) with Suffix Trees. Try it! Re: O(N) Gheorghe Stefan 15 Apr 2004 05:15 write me to dpdokov@yahoo.com or post you idia here ?!?!?!?!?!?!?!?! Solution O(N^3) with some optimization AC 0.001 Your time is not so good after rejudge. :) Re: O(N) Shadow of Death 17 Oct 2007 23:16 Just O(2N) Use Prefix Function! Re: O(N) Artem Khizha [DNU] 4 Aug 2010 23:00 After all, I solved the problem by DP in O(N), counting the number of palindromes, though it is rather hard. 2 Shadow of Death: I'm very interested in solution with prefix-function, would you be so kind to tell more about it? I'm a newbie in string-algorithms, but hope to learn them better. if you have learned suffix arrays you can use that to solve these problem . it's not difficult O(N) used hash function ;) Re: O(N) Soucup Adrian 27 Jul 2012 19:05 Naive O( N ^ 2 ) = 0.015, 116 kb Re: O(N) lichtgestalt2710 13 Feb 2014 06:41 also this can be solved with Manacher's algorithm in O(N) =) Re: O(N) lichtgestalt2710 13 Feb 2014 06:41 also this can be solved with Manacher's algorithm in O(N) =) |
| WA10 | MOPDOBOPOT (USU) | 1923. Scary Politics | 14 Aug 2014 03:43 | 4 |
WA10 MOPDOBOPOT (USU) 18 Nov 2012 13:47 What the hell is 10 test? :) Re: WA10 Tolstobrov Anatoliy 17 Feb 2013 05:31 try: 2 2 02 10 4 0 0 2 1 Answer: 3 1 @Tolstobrov Anatoliy this test should be invalid "Naturally, neither empire will join the alliance its rival is currently in", however it test that one empire is trying to claim a country owned by its rival. Edited by author 08.08.2014 21:05 Re: WA10 Anastasko [Lviv NU] 14 Aug 2014 03:43 Note that "the territories they have once acquired remain parts of the empire FOREVER". This is written less clearly in Russian statement. Then you will pass 10-th test. Good luck! |
| Problem with time | Narek X | 1930. Ivan's Car | 13 Aug 2014 22:31 | 4 |
In this problem I use bfs and Dejikstra, in two cases I got AC, but my solutions are very slowly then others. I can't understand way ? How fast your Dijkstra's algorithm? The best program that I can write run in time 0.171s, but other users solv it in 0.031. My solution with Dijkstra work 0.312s :) |
| WHY WA#5? Python 3.3 | Viktor Tyulpin | 1585. Penguins | 13 Aug 2014 21:33 | 2 |
Hey, I'm using Python and Counter: from collections import Counter print(max(Counter([input() for i in range(int(input()))]))) Works perfectly, but Test 5... Edited by author 12.08.2014 17:55 It's not difficult to get AC with analyzing of first symbol in input string. I did make it. But how do I can do this task with Counter? |
| My Code is O(n). | OIdiot | 1086. Cryptography | 13 Aug 2014 15:02 | 1 |
#include <cstdio> #include <iostream> #include <vector> #include <algorithm> #define SpeedUp ios::sync_with_stdio(false) #define Max (500000) //#define Debug using namespace std; bool p[Max*10]; vector<int> Prime; void init(){ for(int i=2;i<=Max;i++){ if(!p[i]){ Prime.push_back(i); #ifdef Debug cout<<i<<endl; #endif } for(int j=0;j<Prime.size();j++){ int k=i*Prime[j]; if(k>Max) break; p[k]=true; if(i%Prime[j]==0) break; } } } void work(){ int N,k; cin>>N; while(N--){ cin>>k; cout<<Prime[k-1]<<endl; } } int main(){ init(); work(); return 0; } --------------------------------------------------------------------------- Euler's sieve method. Could you plz prove it? |
| WA#2 | NickC8 | 1988. Planet Ocean Landing | 13 Aug 2014 06:14 | 2 |
WA#2 NickC8 17 Nov 2013 18:15 Hi Nick, Sorry, don't know what is the #2. Here are all my tests (all 2D, all with plane speed == 1. However, covered main different cases): -3 0 0 4 2 0 1 res: 4.4220072 -3 0 0 6 4 0 1 res: 5.4139598 0 -3 0 4 6 0 1 res: 5.4139598 0 -3 0 4 0 0 1 res: 2.5949700 -3 0 0 4 0 0 1 res: 4.9511633 3 0 0 4 0 0 1 res: 1.0000000 Edited by author 13.08.2014 06:15 |
| Test №16 | [RISE] Levon Oganesyan [RAU] | 1024. Permutations | 13 Aug 2014 04:12 | 1 |
Test №16 [RISE] Levon Oganesyan [RAU] 13 Aug 2014 04:12 |
| ФакториАААЛы !!!! | Oleksandr | 1083. Factorials!!! | 13 Aug 2014 03:25 | 2 |
Что не так ?? #include <stdio.h> #include <string.h> int main() { int a, fact = 1, i, count; char str[256]; scanf("%i %s", &a,str); for (count = 0; str[count] != '\0';) if (str[count] == '!') count++; if (a%count != 0) for (i = a%count; i <= a; i += count) fact *= i; else { fact *= count; for (i = count; i <= a; i += count) fact *= i; } printf("%i", fact); return 0; } else { //fact *= count; for (i = count; i <= a; i += count) fact *= i; } Here is problem. |
| There is Runtime error in test 1. Can anybody give me hint? | susimus | 1020. Rope | 12 Aug 2014 18:48 | 1 |
|
| ac in c++ | Saeed | 1196. History Exam | 12 Aug 2014 18:00 | 1 |
#include<iostream> #include<conio.h> #include<Math.h> using namespace std; int binarySearch(int A[], int n, int x) { int low, high, mid; low = 0; high = n-1; while (low <= high) { mid = (low + high) / 2; if (x == A[mid]) return(mid); else if (x < A[mid]) high = mid-1; else low = mid + 1; } return(-1); } int main() { int n, a[ 15001 ]; int m, counter = 0; int b; cin>>n; for(int i = 0; i < n; i ++ ) cin>>a[ i ]; cin>>m; for(int i = 0; i < m; i ++ ) { cin>>b; if(binarySearch(a, n, b ) != -1 ) counter ++; } cout<<counter<<endl; return 0; } :) |
| Can it be solved using integers only? | Outermeasure | 1283. Dwarf | 12 Aug 2014 13:04 | 1 |
|