| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| DP solution is very easy | Adhambek | 1531. Zones on a Plane | 19 дек 2014 14:34 | 1 |
deleted: Edited by author 24.12.2014 23:56 |
| Test 4 and two more questions | Alexander Bondarenco | 1880. Собственные числа Psych Up | 19 дек 2014 03:58 | 2 |
What is test 4, there is a question about it but I don't understand the answer. All the eigenvalues are positive integers not exceeding 10^9. Does it mean they are non-zeros? My solution assumes there are not zeros, maybe that's the cause of WA. And why do I get compilation error using Visual C 2010? It's ignoring semicolons. Sorry for this topic, I just initialized array to -1 instead of zero, and tested against it. |
| No subject | zakran | 1021. Таинство суммы | 18 дек 2014 17:42 | 1 |
|
| Объясните, что не так С++ | Sapendo | 1000. A+B Problem | 17 дек 2014 16:16 | 4 |
#include <iostream> using namespace std; int main() { int a=1, b=5, sum=0; sum=a+b; cout<<sum<<endl; return 0; } Ты вводишь два числа, а не определяешь в коде. А система проверки может дать тебе любые два числа, не обязательно a=1 и b=5 ты должен ввести входные данные выводные данные |
| Time limit exceeded | pav1uxa | 1209. 1, 10, 100, 1000... | 17 дек 2014 14:53 | 1 |
Time limit exceeded Test №3 С# using System; public class Test { private static void Main() { ushort n = ushort.Parse(Console.ReadLine()); string result = ""; int t; for (ushort i = 0; i < n; i++) { t = int.Parse(Console.ReadLine()); if (Math.Sqrt((8 * t) - 7) % 1 == 0) result += " 1"; else result += " 0"; } Console.WriteLine("{0}", result); } } Whats wrong? |
| The Power of C# --->AC | Hikmat Ahmedov | 1617. Ползуны | 17 дек 2014 09:39 | 4 |
[code deleted] Edited by moderator 19.11.2019 22:49 [code deleted] Edited by moderator 19.11.2019 22:50 [code deleted] Edited by author 07.10.2014 17:38 Edited by moderator 19.11.2019 22:50 [code deleted] Edited by moderator 19.11.2019 22:50 |
| Why WA#6 | Vladimir Li | 1403. Курьер | 17 дек 2014 05:17 | 3 |
Try test 3 1 10 2 20 2 30 Edited by author 20.03.2007 21:45 |
| Good solution | Nodirbek Islomov | 1079. Максимум | 16 дек 2014 21:33 | 1 |
#include <stdio.h> __int64 n, i, a[200002], b[200002], mx; void solve(){ a[1] = b[1] = mx = 1; for(i = 1 ; i < 100001 ; i ++){ a[i << 1] = a[i]; a[i << 1 | 1] = a[i] + a[i + 1]; if(mx < a[i]) mx = a[i]; b[i] = mx; } while(~scanf("%I64d", &n)){ if(!n) break; printf("%I64d ", b[n]); } } int main(){ solve(); } |
| WA14 pls help | moshcode | 1073. Квадратная страна | 16 дек 2014 16:01 | 1 |
my code: #include<iostream> #include<cmath> using namespace std; main() { unsigned int n,temp,nc; cin>>n; nc=n; temp=sqrt(n); if(n==0) cout<<0; else if(temp*temp==n) cout<<1; else { unsigned int x=-1,m=0,q=4,t; for(unsigned int i=temp;i>=1;i--) { t=i; while(x!=0) { x=n-t*t; n=x; t=sqrt(x); m++; } if(m<q) q=m; if(m==2) break; x=-1; m=0; n=nc; } cout<<q; } } |
| Urraaa... Accepted | Bahodir | TUIT | | 1654. Шифровка | 15 дек 2014 10:28 | 1 |
Accepted... public class CipherMessage1654_Accepted { public static void main(String[] args) { Stack<Character> stack = new Stack<Character>(); Scanner x = new Scanner(System.in); String s = x.nextLine(); for (int i = 0; i < s.length(); i++) { if (s.charAt(i) >= '`' && s.charAt(i) <= '9' || s.charAt(i) >= 'a' && s.charAt(i) <= 'z') { if (stack.isEmpty()) { stack.push('`'); } if (s.charAt(i) != stack.peek()) stack.push(s.charAt(i)); else stack.pop(); } } for (int i = 0; i < stack.size(); i++) { if (stack.get(i) != '`') System.out.print(stack.get(i)); } } } Edited by author 16.12.2014 09:49 |
| WA2 please help | vdprog | 1470. НЛО | 15 дек 2014 04:39 | 1 |
Who can give test 2. In some topic was given some and my programm gives right result. |
| easy[Java] | Evgeniy[VVV] | 1457. Теплотрасса | 15 дек 2014 00:43 | 2 |
cycle for,no more. import java.util.Scanner; public class easys { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); int sum = 0; int curr = 0; double result = 0.0; for(int i=0;i<N;i++){ curr = in.nextInt(); sum = sum + curr;
} result = (double)sum/N; System.out.printf("%.6f",result); } } public class HeatingMain1457_Accepted { public static void main(String[] args) { PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out)); Scanner x = new Scanner(System.in); short n = x.nextShort(); double s = 0; for (int i = 0; i < n; i++) { s += x.nextInt(); } writer.printf("%.6f", s / n); writer.close(); } } |
| А это куда ...? | vdprog | 1889. Объявление в аэропорту | 15 дек 2014 00:03 | 1 |
.....и что объявление произнесли на каждом языке не более одного раза. третий вариант 3 zulu zulu zulu ответ 1 язык |
| Can we do this in O(N) ? | Nikunj Banka | 1031. Железнодорожные билеты | 12 дек 2014 23:43 | 4 |
My solution runs in O(N logN) and it uses heap data structure. The discussion forums hint that there may be a O(N) time solution. Is there a linear time algorithm? heap?:D just use lower_bound And, BTW, Yes there is. At first I used Binary Search on each station but on the next station you can start with the previous index. code: int canReach1 = A[i] + L1; while (ind1 <= end && A[ind1] <= canReach1) ind1 ++; i've used dp (which is easy to notice) with some optimization. suppose we have three stations s1 s2 s3 and there exists path s1-s2 covered with l1, and path s1-s3 also covered with l1. then we can skip the analysis from s2. we can easily reduce used time if we create list of "allowed" stations to analyze (like s3) |
| Can O(nlogn) java program get AC? | begi | 1069. Код Прюфера | 12 дек 2014 23:38 | 2 |
As I said before I think java programs should get higher time limit. My java program gets TLE on test #4 or #5 285ms. In my opinion my program runs in O(nlogn). Below I gave the code that gets TLE: import java.util.ArrayList; import java.util.Arrays; import java.util.PriorityQueue; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList<Integer> lst = new ArrayList<>(); int[] sorted; PriorityQueue<Integer>[] g; int[] degree = new int[8000]; Arrays.fill(degree, 0);
// O(n) while (sc.hasNextInt()) { int tt = sc.nextInt() - 1; lst.add(tt); degree[tt]++; } g = new PriorityQueue[lst.size() + 1]; sorted = new int[lst.size() + 1]; // O(n) for (int i = 0; i < lst.size() + 1; i++) { sorted[i] = i; g[i] = new PriorityQueue<>(); } // find initial leaves O(nlogn) PriorityQueue<Integer> leaves = new PriorityQueue<>(); for (Integer y : sorted) { if (degree[y] == 0) { leaves.add(y); } } // O(nlogn) for (int x : lst) { degree[x]--; int y = leaves.poll(); g[x].add(y); g[y].add(x);
if(degree[x] == 0){ leaves.add(x); } }
// O(nlogn) for (int i = 0; i < g.length; i++) { System.out.print((i + 1) + ":"); while (!g[i].isEmpty()) { System.out.print(" " + (g[i].poll() + 1)); } System.out.println(""); } } } Edited by author 12.12.2014 23:17 Oh gosh, I used buffered reader instead of Scanner.nextInt() and got AC, micro-optimizing your code for I/O is not the right thing for this problem IMO: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] input = br.readLine().split(" "); |
| Memory limit on #19 | JaleChaki | 1106. Две команды | 12 дек 2014 20:52 | 1 |
Please? can I see 19 test& |
| WA 3 | Olya | 1796. Парк аттракционов | 12 дек 2014 18:22 | 1 |
WA 3 Olya 12 дек 2014 18:22 What is WA 3 Test. Give me please some example |
| WA5 | Michael Uskov [USU] | 1721. Две стороны одной монеты | 12 дек 2014 15:41 | 1 |
WA5 Michael Uskov [USU] 12 дек 2014 15:41 Could you give me some tests please? |
| Please Help, TLE #21 | Najmaddin Akhundov | 1510. Порядок | 12 дек 2014 12:31 | 1 |
#include<iostream> using namespace std; int arr[500005]; int main() { int n; cin >> n; long long int a; int p = 0; arr[0] = -1; for (int i = 0; i < n; i++) {
cin >> a; if (a == arr[p] || p == 0) { p++; arr[p] = a; } else p--; }
cout << arr[1] << endl;
} Edited by author 12.12.2014 12:48 Edited by author 12.12.2014 12:48 |
| why I get WA(3)????Help me!!!! | zhl | 1079. Максимум | 12 дек 2014 10:45 | 3 |
program p1079; var a:array[0..100000] of longint; m:array[1..100000] of longint; n,max,i:longint; begin max:=1; a[1]:=1; m[1]:=1; readln(n); while n<>0 do begin if n<=max then writeln(m[n]) else begin for i:=max+1 to n do begin if odd(i) then a[i]:=a[i div 2]+a[i div 2+1] else a[i]:=a[i div 2]; if a[i]>=m[i-1] then m[i]:=a[i] else m[i]:=m[i-1]; end; end; writeln(m[n]); readln(n); end; end. test: 1 2 3 0 right answer is: 1 1 2 Good luck)) Urraaa... Accepted ...!!! Good test.Thank you very much (apple_worm)...!!! |