| Show all threads Hide all threads Show all messages Hide all messages |
| No subject | Viktor Krivoshchekov`~ | 2046. The First Day at School | 22 Jan 2019 18:38 | 1 |
No subject Viktor Krivoshchekov`~ 22 Jan 2019 18:38 Edited by author 09.03.2021 22:26 |
| i want to know whether there exits this data? | yejinru | 1003. Parity | 22 Jan 2019 11:08 | 3 |
10 6 1 2 even 1 1 even 3 4 odd 5 6 even 1 6 even 7 10 odd i think the answer of this data should be 1,but my program answer is 4 but it return an accepted! why?i think 4 is correct. "1 2 even" -> first 2 digits are 00 or 11 "1 1 even" -> first digit is 0. So if first 2 digits are 00, everything is ok |
| Why WA 5 test? | Meyrlan | 1005. Stone Pile | 22 Jan 2019 08:57 | 7 |
sort(a + 1, a + 1 + n); reverse(a + 1, a + 1 + n); for(int i = 1; i <= n; i++){ if(sum1 > sum2){ sum2 += a[i]; } else{ sum1 += a[i]; } } cout << abs(sum1 - sum2); let me give you an example 13 14 27 if I understand your solution you are sorting it and then add to left or to the right. in this example the diff is 0 what your program returns? The same thing. I tried to enter almost everything, it works correctly, but i always have WA on 5 test 2 Test Case : 5 5 5 4 3 3 Edited by author 15.01.2019 16:49 Edited by author 06.11.2018 20:49 |
| Reading ip and mask on c++ | v13 [Kungur] | 1072. Routing | 21 Jan 2019 14:50 | 1 |
If you write on c++ you can do this: char dot; unsigned int x,ip; ip = 0; for (int i = 24; i >= 8; i -= 8) { cin >> x >> dot; x <<= i; ip |= x; } cin >> x; ip |= x; ------------------ Now you have ip, same you can read mask. Edited by author 21.01.2019 14:50 Edited by author 21.01.2019 14:52 |
| To admin: Ошибка при чтении данных или... | SpamBot | 1083. Factorials!!! | 21 Jan 2019 11:57 | 1 |
На Паскале не работает код если начать его так: read(n); read(s); (или readln(s)) n - longint, s - string Но если так: readln(s); А затем разрезать на n и s1, то всё ОК. Разве так и должно быть? |
| test2 | Igor | 1355. Bald Spot Revisited | 19 Jan 2019 15:09 | 3 |
test2 Igor 30 Aug 2005 14:03 #include <iostream> using namespace std; long long a,b,t,c,d,k,s,f; int main () { c = 1; k = 0; cin >>t; for (t;t>=1;--t) { cin >>a; cin >>b; if ( b%a==0) { for( ; d != b; ++c ) { d = a*c; if ( b % d == 0) { k= k+1; a = d; c = 1; } } cout << k<<"\n"; } else cout << "0\n"; c=1; k=0; } return 0;
} Excuse me but your algo is wrong. input: 5 1 1000000000 1 1000000000 1 1000000000 2 10 2 10 your answer: 19 0 0 2 0 right anse: 19 19 19 2 2 Check it up!.. Press any key to continue . . . Re: test2 Viktor Krivoshchekov`~ 19 Jan 2019 15:09 |
| Solution metrics Execution time and Memory used | Serg_Bloim (ONPU) | | 19 Jan 2019 07:42 | 1 |
Hi there! I'm curious regarding submission metrics time and memory. Is this the avg time and avg memory of all the tests or maximum time and maximum memory used in the worst test? Can anybody please reveal how does the system count time and memory for different languages? I would like to reproduce it locally before the submission. I use golang. Thanks |
| С# Solution | Lada Belonogova | 1567. SMS-spam | 18 Jan 2019 13:22 | 1 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace phrase { class Program { static int First(string input, string[]array) { int col = Convert.ToInt32(input.Length); if (col>0&&col<=1000) { int countArr = 0,countStr = 0,c = Convert.ToInt32(array.Length),count = 0,indexStr=0; for (; countArr < c; countArr++) { for (; (indexStr = input.IndexOf(array[countArr], countStr)) !=-1; countStr = indexStr + 1) { count++; } countStr = 0; } return count; } return 0; } static void Main(string[] args) { string[] one = new string[] { "a", "d", "g", "j", "m", "p", "s", "v", "y", ".", " " }; string[] two= new string[] { "b", "e", "h", "k", "n", "q", "t", "w", "z", "," }; string[] three = new string[] { "c", "f", "i", "l", "o", "r", "u", "x", "!" }; string input = Console.ReadLine(); int a = First(input,one); int b = First(input,two); int c = First(input,three); Console.WriteLine(a+(b*2)+(c*3)); } } } |
| I have AC with such idea but I don't understand how to get a formula or faster solution | IlushaMax | 1023. Buttons | 18 Jan 2019 12:11 | 3 |
var i,n,l,j:longword; found:boolean; begin readln(n); repeat found:=False; for j:=3 to n div 2 do begin if n mod j=0 then begin found:=True; break; end; end; if found then n:=j; until not found; writeln(n-1); readln; end. Please help me to optimize my code. It's 0.405 sec for j := 3 to sqrt(n) do will help you :) > for j := 3 to sqrt(n) do will help you :) will it? for sqrt(8) = 2.8, but answer should be 4 - 1 = 3 |
| Why Runtime error | Izazul Haque Saad | 1001. Reverse Root | 17 Jan 2019 01:46 | 1 |
#include<stdio.h> #include<stdlib.h> #define x 100000 int main() { long long int n , c=0,i; double ar[x] = {}; while(scanf("%lld",&n)){ if(n < 0) break; ar[c++] = n; } for(i=c-1; 0<=i; i--){ printf("%.4lf\n",sqrt(ar[i])); } return 0; } |
| WA 1 Что не так? | Sergo | 1068. Sum | 16 Jan 2019 22:17 | 2 |
var
i, n: integer; c : real; begin read(n); c := 0; if n > 0 then begin for i := 1 to n do c := n; write(c); end; if n <= 0 then begin for i := 1 downto n + 1 do c := (-((-n) * (1 - n) / 2) + 1); write(c); end; end. Доп. примеры/add. examples: n=-5 -5+(-4)+(-3)+(-2)+(-1)+0+1 n=5 5+4+3+2+1 n=0 0+1 Арифмет. прогрессия/arithm. progression |
| give a configuration, is there O(P) sol to judge it has a sol?? | Shen Yang | 1589. Sokoban | 13 Jan 2019 12:42 | 2 |
I think the answer is probablye Yes... I think it is relating to the number of inverse pairs of permuation.. |
| Hint.. | esger | 1356. Something Easier | 12 Jan 2019 19:52 | 4 |
Be sure that(at least for the given interval, [4,2*10^9]) every even number can be shown as sum of two prime numbers. 1. if n is prime, {n} 2. if n is even, {n = p1 + p2} 3. if n is odd {n = 3 + p1 + p2} ( n-3 is even, so that recall second case.) For convenience, prime numbers under 10^5 can be initialized. Edited by author 03.12.2012 03:00 Edited by author 03.12.2012 03:00 Re: Hint.. Mishail [USU SESC division by zero masters] 21 Feb 2013 23:57 If he could proof it, he would get 1 thousand million dollar Edited by author 02.08.2015 20:59 > if n is odd {n = 3 + p1 + p2} ( n-3 is even, so that recall second case.) IMO this is wrong. 85 = 2 + 83 is the counter-case. > For convenience, prime numbers under 10^5 can be initialized. this way too big. :) Edited by author 12.01.2019 19:53 Edited by author 12.01.2019 19:54 |
| No subject | Alexandr_Morozov | | 12 Jan 2019 18:24 | 1 |
|
| My code AC with GCC, but WA with G++. Any one help explain it? | some_programming_novice | 1126. Magnetic Storms | 12 Jan 2019 12:12 | 1 |
Weird. Edited by author 12.01.2019 12:15 |
| WA 22. Give me some tests that may help | Erkebulan | 2033. Devices | 11 Jan 2019 15:04 | 1 |
|
| Use C and Visual C 2017, Luke | a.menshchikov | 1220. Stacks | 10 Jan 2019 18:46 | 1 |
C++ costs 200 kb (Visual C++ and 400 kb other compilers). |
| When will Grand Theft Array VI be released? | BowieD | 2000. Grand Theft Array V | 10 Jan 2019 17:20 | 1 |
When do we go from one-dimensional array to two-dimensional? This will be so rad! |
| A better solution | ComebackSeason | 1119. Metro | 9 Jan 2019 20:32 | 4 |
I got an AC with dynamic programming and without a graph and I am frustrated with my memory consumption. I used C++ for this and i've got 0,31s and 16000 KB. I guess my solution consumed so much memory because I've stored 2 matrices, one for grid second for diagonales. Matrix[i][j] = min (Matrix[i-1][j]+100, Matrix[i][j-1]+100, Matrix[i-1][j-1] + Diag[i][j]) where Diag[i][j] is either 100 * sqrt(2) or Infinity. I wonder if there is a better solution. I think a simple BFS could give me an answer, Bellman-Ford and Dijkstra's algorithms will give it for sure though. Nevertheless, I've never worked with a graph where every vertex is a 2D point. How should i store it? vector <int> g[maxN][maxN] ? How do I fill it with values efficently? But when Diag[i][j] get infinity sir I think the main cause of memory consumption is the matrix of DOUBLES. Even a simple array of doubles consumes a lot of memory. Even for the solution involving graph and shortest paths would use 'huge' amount of memory, since you would also need a 2 dimensional array of doubles (I suppose). I managed to solve it using 9360KB. Edited by author 14.06.2018 17:45 a better solution is to use dynamic programming to find the longest increasing sequence of diagonals, which there are 100 at most. then ``` min = (n + m - maxDiagonals * 2) * distance + maxDiagonals * diagonalDistance ``` |
| wa #15 | 👑TIMOFEY👑 | 1964. Chinese Dialects | 8 Jan 2019 00:11 | 1 |
wa #15 👑TIMOFEY👑 8 Jan 2019 00:11 (yes, somehow I've got wa15) try this test (it helped me to get AC): 10 3 7 7 7 |