I keep getting wrong answer with my code. I don't know is it a problem in the algorithm or formatting?
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
int n, e;
int g[1000][1000];
int capacity[1000][1000];
int flow[1000][1000];
int residual[1000][1000 ...
Search found 6 matches
- Wed Nov 18, 2009 9:15 pm
- Forum: Volume 8 (800-899)
- Topic: 820 - Internet Bandwidth
- Replies: 43
- Views: 27941
- Tue Nov 18, 2008 1:33 pm
- Forum: Algorithms
- Topic: please help me find intersection between two line segments
- Replies: 1
- Views: 1360
please help me find intersection between two line segments
I know that's a trivial problem but I can't find an easy simple general equation for it.
Given two line segments AB & CD how to determine if they intersect or not and get the point of intersection. If I have the X, Y coordinates. Ax, Ay, Bx, By, Cx, Cy, Dx, Dy.
Something else, If it was between a ...
Given two line segments AB & CD how to determine if they intersect or not and get the point of intersection. If I have the X, Y coordinates. Ax, Ay, Bx, By, Cx, Cy, Dx, Dy.
Something else, If it was between a ...
- Tue Nov 11, 2008 10:17 pm
- Forum: Algorithms
- Topic: Subset Problem Minimum sum- Please Help before it's too late
- Replies: 2
- Views: 2233
Re: Subset Problem Minimum sum- Please Help please it's too late
Thank you for that quick reply. I thought about dividing the numbers into positive and negative but didn't know what to do next :D
I didn't understand what you mean by the "cite" of this problem. Anyway that's the link of where I got it from. It was in the national contest in Egypt last Saturday ...
I didn't understand what you mean by the "cite" of this problem. Anyway that's the link of where I got it from. It was in the national contest in Egypt last Saturday ...
- Tue Nov 11, 2008 7:53 pm
- Forum: Algorithms
- Topic: Subset Problem Minimum sum- Please Help before it's too late
- Replies: 2
- Views: 2233
Subset Problem Minimum sum- Please Help before it's too late
Given a list of N integers with absolute values no larger than 10^15, find a non
empty subset of these numbers which minimizes the absolute value of the sum
of its elements. In case there are multiple subsets, choose the one with fewer
elements.
Input Specification
The input contains multiple ...
empty subset of these numbers which minimizes the absolute value of the sum
of its elements. In case there are multiple subsets, choose the one with fewer
elements.
Input Specification
The input contains multiple ...
- Wed Aug 06, 2008 1:39 pm
- Forum: Volume 3 (300-399)
- Topic: 311 - Packets
- Replies: 29
- Views: 21004
Re: 311 - Packets
I've tried all I/Os and they were all correct but I'm still getting a WA. Can anyone help? I'd be grateful. Thank you :)
#include <iostream>
using namespace std;
int main()
{
int b1, b2, b3, b4, b5, b6;
while (cin >> b1 >> b2 >> b3 >> b4 >> b5 >> b6)
{
if(b1 == b2 && b2 == b3 && b3 == b4 ...
#include <iostream>
using namespace std;
int main()
{
int b1, b2, b3, b4, b5, b6;
while (cin >> b1 >> b2 >> b3 >> b4 >> b5 >> b6)
{
if(b1 == b2 && b2 == b3 && b3 == b4 ...
- Thu Nov 22, 2007 1:13 am
- Forum: Volume 2 (200-299)
- Topic: 216 - Getting in Line
- Replies: 57
- Views: 31083
i tried all the sample I/O but still getting wrong answer. :
please help please please please
i tried all the sample I/O but still getting wrong answer. :'(
[/code]#include <iostream>
#include <fstream>
#include <cmath>
#include <iomanip>
using namespace std;
//ifstream in ("input.txt");
//ofstream out ("output.txt");
long n;
long path[10];
bool valid[10 ...
i tried all the sample I/O but still getting wrong answer. :'(
[/code]#include <iostream>
#include <fstream>
#include <cmath>
#include <iomanip>
using namespace std;
//ifstream in ("input.txt");
//ofstream out ("output.txt");
long n;
long path[10];
bool valid[10 ...