Search found 88 matches

by technobug
Fri Nov 18, 2005 12:27 am
Forum: Volume 109 (10900-10999)
Topic: 10944 - Nuts for nuts..
Replies: 35
Views: 18592

i read the pdf and found it nice but i dont know how to implement it without looking like backtracking.... anyone can give me a hint?
by technobug
Fri Nov 18, 2005 12:26 am
Forum: Volume 109 (10900-10999)
Topic: 10943 - How do you add?
Replies: 38
Views: 17351

ac, but took 2 seconds... i used cin and cout.... does anyone know how to make it faster?
by technobug
Thu May 19, 2005 2:09 pm
Forum: Volume 102 (10200-10299)
Topic: 10261 - Ferry Loading
Replies: 41
Views: 26931

10261 - DP problem

I have beein trying this one.
I found out that:

read a new car
- if i cant add any previous cars, dont try this one
- i can either add the car to the left or to the right, so try it by doing:
for(i=tam;i>=0;i--) if this position is checked THEN
if i can add it at position i (which means to the ...
by technobug
Thu Apr 14, 2005 6:08 pm
Forum: Volume 1 (100-199)
Topic: 117 - The Postal Worker Rings Once
Replies: 58
Views: 25049

Hmmm... i tried going with floyd warshal...... the rest is the same. Any ideas?

#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>

using namespace std;
#define FOR(a,b) for(int a=0;a<b;a++)

#define MAXI (50)
int mat[MAXI][MAXI];
int t[MAXI];

void clear() {
FOR(i ...
by technobug
Mon Feb 21, 2005 5:17 am
Forum: Volume 108 (10800-10899)
Topic: 10817 - Headmaster's Headache
Replies: 25
Views: 20092

My algorithm has runtime O(n * 3^s). As I want to reduce the memory usage, I use 2 pieces of 3^s memory, on start of very loop I copy one to another(I guess you know what I say... :)

O(n*3^s) here...... but it gets faster and with less memory as it goes bottom up using just one table size (3 ^ s ...
by technobug
Sun Feb 20, 2005 10:28 pm
Forum: Volume 108 (10800-10899)
Topic: 10817 - Headmaster's Headache
Replies: 25
Views: 20092

Great.... thanks Larry, got AC with +-0.9secs

I am not an expert so everything i did in here was a challenge for me...

What I did looks like a Nth dimension knapsack, but mapping the dimensions to a simple array.... (another challenge for me)
by technobug
Sun Feb 20, 2005 8:17 pm
Forum: Volume 108 (10800-10899)
Topic: 10817 - Headmaster's Headache
Replies: 25
Views: 20092

10817

Is this a max flow problem? Any other similar ones in the problem set?
by technobug
Wed Feb 16, 2005 5:20 am
Forum: Volume 108 (10800-10899)
Topic: 10819 - Trouble of 13-Dots
Replies: 67
Views: 61039

i got 9 wa :) before ac during the contest
by technobug
Wed Feb 16, 2005 5:18 am
Forum: Volume 108 (10800-10899)
Topic: 10817 - Headmaster's Headache
Replies: 25
Views: 20092

Hey there.... what was the idea behind your algorithm?
by technobug
Wed Feb 16, 2005 5:17 am
Forum: Volume 108 (10800-10899)
Topic: 10814 - Simplifying Fractions
Replies: 30
Views: 21856

ps: and wants to share it :)
by technobug
Wed Feb 16, 2005 5:17 am
Forum: Volume 108 (10800-10899)
Topic: 10814 - Simplifying Fractions
Replies: 30
Views: 21856

i tried to use java (copied BigInteger and adapted it) but it did not work out... java sucks here

but back to C, I only have the basic arithmetic implemented, does anyone have an 'open source' one? :)
by technobug
Fri Feb 11, 2005 3:19 am
Forum: Volume 103 (10300-10399)
Topic: 10374 - Election
Replies: 44
Views: 22915

Either tests or suggestions are welcome....
by technobug
Fri Feb 11, 2005 3:19 am
Forum: Volume 103 (10300-10399)
Topic: 10374 - Election
Replies: 44
Views: 22915

seconds one is here:


#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string.h>

using namespace std;

int dep, par;
char d[30][100];
int dp[30];
int vot[30];
char p[30][100];

char *getl(char *s) {
gets(s);
int len = strlen(s);
while(len && (s[len-1]==13 || s[len-1]==10 ...
by technobug
Fri Feb 11, 2005 3:18 am
Forum: Volume 103 (10300-10399)
Topic: 10374 - Election
Replies: 44
Views: 22915

I must be missing something here.... I tried this one twice.... first time, wrong answer, rewrote it from scratch, WA again... its easy, I just did what they said...

First one is here:



#include <stdio.h>
#include <string.h>

int main() {

int i,j,k,l,m,n,o,p;
char part[30][100];
char cand[30 ...
by technobug
Thu Feb 10, 2005 12:32 am
Forum: Volume 7 (700-799)
Topic: 743 - The MTM Machine
Replies: 12
Views: 9049

I have implemented all rules and cant get it right, tried a lot of input and i think its ok.
It should be an easy one...

Any suggestions?


#include <iostream>
#include <string>

using namespace std;

bool b;

string parse(string s,int len) {

if(s[0]=='2' && len==1) goto bz;
if(s[0]=='2 ...

Go to advanced search