## Search found 96 matches

Wed Mar 09, 2016 5:57 pm
Forum: Volume 124 (12400-12499)
Topic: 12426 - Counting Triangles
Replies: 1
Views: 688

### Re: 12426 - Counting Triangles

In current judge machine
O(n^3) gets AC..
But you can make O(n^2 log n )
Mon Dec 14, 2015 1:15 pm
Forum: Volume 13 (1300-1399)
Topic: 1386 - Cellular Automaton
Replies: 1
Views: 530

### Re: 1386 - Cellular Automaton

Matrix Exponentiation, But need to optimize Here the matrix is cyclic Let's say this n=5,d=1 [1 1 0 0 1 ] [1 1 1 0 0] [0 1 1 1 0] [0 0 1 1 1] If we can determine first row of this matrix, we can generate the other row. So we need to keep only thee first row of this matrix and multiply with only to g...
Wed Nov 11, 2015 11:29 pm
Forum: Volume 13 (1300-1399)
Topic: 1306 - The K-League
Replies: 0
Views: 2016

### Re: 1306 - The K-League

Baseball elimination problem. Search google and you can get info.
Wed Nov 11, 2015 7:40 am
Forum: Volume 13 (1300-1399)
Topic: 1317 - Concert Hall Scheduling
Replies: 0
Views: 906

### Re: 1317 - Concert Hall Scheduling

Algorithm to solve:
Mincost Maxflow
Graph Construct:
1. for i,j,w , give i -> j+1, with capacity 1, cost -w
2. for i=0 to 355, give i->i+1, with capacity 2, cost 0
3. Calculate mincost Max flow, ans = - MincostMaxflow
Fri Nov 06, 2015 8:46 pm
Forum: Volume 10 (1000-1099)
Topic: 1056 - Degrees of Separation
Replies: 1
Views: 2000

### Re: 1056 - Degrees of Separation

Dataset is okay. But the edges may not contain all the nodes.
Fri Nov 06, 2015 6:25 pm
Forum: Volume 12 (1200-1299)
Topic: 1243 - Polynomial-time Reductions
Replies: 0
Views: 1982

### Re: 1243 - Polynomial-time Reductions

Hints :
1. Convert into DAG by calculating SCC
2. In the dag, Build a new graph using all possible edges
3. Now remove the redundant edges
The third step is tricky. Takes O(m*n)
Tue Jul 07, 2015 11:18 am
Forum: Volume 117 (11700-11799)
Topic: 11782 - Optimal Cut
Replies: 4
Views: 2390

### Re: 11782 - Optimal Cut

Getting WA I have tested several i/o all of them were correct #include <bits/stdc++.h> using namespace std; /*------- Constants---- */ #define LMT 2100000 #define ll long long #define ull unsigned long long #define mod 1000000007 #define MEMSET_INF 63 #define MEM_VAL 1061109567 #define FOR(i,n) for(...
Sun Jul 05, 2015 6:56 pm
Forum: Volume 11 (1100-1199)
Topic: 1136 - Help R2-D2!
Replies: 0
Views: 995

### Re: 1136 - Help R2-D2!

Using Segment Tree , I am getting TLE ?? Isn't input terminates with EOF ?? My code : #include <bits/stdc++.h> using namespace std; /*------- Constants---- */ #define LMT 1000006 #define ll long long #define ull unsigned long long #define mod 1000000007 #define MEMSET_INF 63 #define MEM_VAL 10611095...
Thu Jun 25, 2015 1:29 pm
Forum: Volume 120 (12000-12099)
Topic: 12083 - Guardian of Decency
Replies: 2
Views: 1552

### Re: 12083 - Guardian of Decency

Getting WA . Why ?? Using MCBM to find MIS.. // // main.cpp // 12083 - Guardian of Decency // // Created by Repon Macbook on 6/25/15. // Copyright (c) 2015 Repon Macbook. All rights reserved. // #include <bits/stdc++.h> using namespace std; /*------- Constants---- */ #define LMT 505 #define ll long ...
Mon Jun 22, 2015 11:13 pm
Forum: Volume 129 (12900-12999)
Topic: 12911 - Subset sum
Replies: 4
Views: 5835

### Re: 12911 - Subset sum

Hi , I am using Meet In The Middle Technique for this Problem
Got AC
But Time > 2s ...

I see some other solution takes ~.1 sec..

What algorithm is needed to get such execution time ??
Sun Jun 14, 2015 10:38 pm
Forum: Volume 119 (11900-11999)
Topic: 11964 - Equation
Replies: 0
Views: 735

### Re: 11964 - Equation

I am using DP
But TestCase is too much ,
I need to calculate for each test case , because The mod is changing..
Anything To do with MOD ??

My Programs ComPlexity : Tcase * k * 21
Sun Jun 14, 2015 12:49 pm
Forum: Volume 126 (12600-12699)
Topic: 12608 - Garbage Collection
Replies: 2
Views: 10528

### Re: 12608 - Garbage Collection

Why WA ??? #include <bits/stdc++.h> using namespace std; /*------- Constants---- */ #define LMT 10005 #define ll long long #define ull unsigned long long #define mod 1000000007 #define MEMSET_INF 63 #define MEM_VAL 1061109567 #define FOR(i,n) for( int i=0 ; i < n ; i++ ) #define mp(i,j) make_pair(i,...
Sun Jun 07, 2015 8:44 pm
Forum: Volume 11 (1100-1199)
Topic: 1121 - Subsequence
Replies: 5
Views: 3411

### Re: 1121 - Subsequence

Use Sliding Window to get AC
Sat Jun 06, 2015 6:29 pm
Forum: Volume 121 (12100-12199)
Topic: 12176 - Bring Your Own Horse
Replies: 1
Views: 1782

### Re: 12176 - Bring Your Own Horse

AC with Kruskal MST algorithm ...
Thu May 28, 2015 7:20 am
Forum: Volume 14 (1400-1499)
Topic: 1423 - Guess
Replies: 0
Views: 817

### Re: 1423 - Guess

I am using dfs with pruning ... But TLE ?
What approach need to use ?