| Show all threads Hide all threads Show all messages Hide all messages |
| The same code, different compilers | MaximCherchuk | 1048. Superlong Sums | 23 Aug 2014 02:21 | 1 |
This is my code. I got WA 1 on G++ and G++11, but AC on Visual C++ 2010. Why? #include <iostream> const int M = 1000*1000+1; char a[M], b[M]; int n; using namespace std; void read() { ios_base::sync_with_stdio(0); cin >> n; for(int i = n-1; i >= 0; --i) { cin >> a[i] >> b[i]; a[i] -= 48; b[i] -= 48; } } void solve() { for(int i = 0; i < n; ++i) { a[i] += b[i]; if(a[i] > 9) { a[i + 1]++; a[i] -= 10; } } } void print() { for(int i = n-1; i >= 0; --i) { cout << (int)a[i]; } } int main() { read(); solve(); print(); } |
| Memory limit exceeded | Enoch | 1001. Reverse Root | 22 Aug 2014 13:53 | 2 |
#include <stack> #include <cmath> #include <iostream> int main() { unsigned long long int n; std::stack<unsigned long int> numbers; while (!std::cin.eof()) numbers.push(n); while (!numbers.empty()) { std::cout << sqrt( double( numbers.top() ) ) << " "; numbers.pop(); } return 0; } Probably the stack this code builds is too large, but I can't see how to optimise it, given the sample numbers. I don't think your first while loop ever terminates. |
| Admins, can you show me test#3,WA,don't understand why? 1332. Джинн-бомбардировки | Anastasia | | 20 Aug 2014 18:37 | 1 |
Admins, can you show me test#3,WA,don't understand why? 1332. Джинн-бомбардировки Edited by author 20.08.2014 18:37 Edited by author 20.08.2014 18:37 Edited by author 20.08.2014 18:38 Edited by author 20.08.2014 18:38 Edited by author 20.08.2014 18:38 Edited by author 20.08.2014 18:39 |
| Bug in checker?? | Vladimir Leskov {SESC USU} | 1474. About Frogs | 20 Aug 2014 17:40 | 1 |
Edited by author 24.08.2014 16:33 |
| Test cases | uynguyen | 2009. Canteen Line | 20 Aug 2014 10:08 | 1 |
The example is not clear enough. Does anyone provide more testcases/examples for this problem? |
| WA5 | Dmitriy99 | 1981. Parallel and Perpendicular | 20 Aug 2014 06:03 | 2 |
WA5 Dmitriy99 28 Jul 2014 19:37 Can you give some tests, please? Re: WA5 Fetisov Alex [Psych Up club] 20 Aug 2014 06:03 Think about the parallel case for even number of vertices. |
| Why wrong answer C# | Md. Hasib Hasan Tarafder | 1001. Reverse Root | 19 Aug 2014 21:24 | 1 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ReverseRoot { class Program { static void Main(string[] args) { string line; string input = ""; double sqrt; while (!String.IsNullOrWhiteSpace(line = Console.ReadLine())) { input += " "; input += line;//but here it seems to be an infinite loop } if (Encoding.UTF8.GetBytes(input).Length / 1024 > 256) { Console.WriteLine("Sorry! Long Input Stream"); } else { string[] arr = input.Split(' '); for (int i = arr.Length - 1; i >= 0; i--) { if (!String.IsNullOrWhiteSpace(arr[i])) { sqrt = Math.Sqrt(Int64.Parse(arr[i])); if (sqrt == 0) Console.WriteLine(sqrt.ToString("0.0000")); else Console.WriteLine(sqrt.ToString("#.####")); } } } } } } |
| If you have WA#9 | [RISE] Levon Oganesyan [RAU] | 1118. Nontrivial Numbers | 19 Aug 2014 21:04 | 2 |
I have 9 times WA#9 and all becouse I don't use double... If you have WA#9, use double in computing triliality, and get AC =) Good Luck! |
| easy[Idea of solution] | Evgeniy[VVV] | 1567. SMS-spam | 19 Aug 2014 19:54 | 1 |
|
| New problem 1597 Chernobyl’ Eagle on a Roof. Version 2 | Vladimir Yakovlev (USU) | 1597. Chernobyl’ Eagle on a Roof. Version 2 | 19 Aug 2014 00:14 | 1 |
New problem was added to the Problem set. Thanks to Sergey Vedernikov. |
| 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) =) |