Search found 79 matches

by ec3_limz
Sat Apr 05, 2003 7:12 am
Forum: Volume 1 (100-199)
Topic: 116 - Unidirectional TSP
Replies: 226
Views: 37481

#116 - Unidirectional TSP (WA) -- ?!?!?!?!

Got me a WA. Same story. Please help me or donate some sample test data. [cpp]#include <limits.h> #include <stdio.h> #include <string.h> int nrow, ncol, map[10][100]; int dptab[10][100], pre[10][100], path[100], best[100], min; bool input() { int i, j; if (scanf("%d%d", &nrow, &ncol) != 2) return fa...
by ec3_limz
Wed Mar 26, 2003 5:25 pm
Forum: Volume 1 (100-199)
Topic: 144 - Student Grants
Replies: 21
Views: 3643

144 - Students' Grants (WA)

Are there hidden traps in this problem? Please help. [cpp]#include <stdio.h> int nguy, cap, idx[25], grant[25]; void init() { int i; for (i = 0; i < nguy; i++) { idx = i + 1; grant = 40; } } void movetoback() { int tmp1, tmp2, i; tmp1 = idx[0], tmp2 = grant[0]; for (i = 0; i < nguy - 1; i++) idx = i...
by ec3_limz
Wed Mar 26, 2003 5:24 pm
Forum: Volume 1 (100-199)
Topic: 130 - Roman Roulette
Replies: 25
Views: 2487

130 - Roman Roulette (WA)

I don't know what's wrong with this code. Please help. [cpp]#include <stdio.h> #include <string.h> bool occ[100]; int nguy, die; void sim() { bool bury; int count, left, last, i; bury = false, count = 0, left = nguy; for (i = 0; left > 1; i = (i + 1) % nguy) { if (occ ) count++; if (count >= die) { ...
by ec3_limz
Wed Mar 26, 2003 3:11 pm
Forum: Volume 3 (300-399)
Topic: 317 - Hexagon
Replies: 3
Views: 2740

317 - Hexagon

Can anyone suggest an algorithm for this problem? It appears that brute force will take too much time, and I can't find an efficient algorithm yet....

Thanks.
by ec3_limz
Mon Feb 10, 2003 3:37 pm
Forum: Algorithms
Topic: Algorithm for Identifying "Regularity" Subsequence
Replies: 7
Views: 2914

Algorithm for Identifying "Regularity" Subsequence

Suppose we define an ascending sequence as a[1 to n] where a[1] < a[2] < a[3] < ... < a[n] and where the difference between any two consecutive numbers in the a[1 to n] are the same. Now the problem is to find the length of the longest ascending sequence that is the subsequence of another sequence. ...
by ec3_limz
Wed Feb 05, 2003 5:17 pm
Forum: Volume 103 (10300-10399)
Topic: 10323 - Factorial! You Must be Kidding!!!
Replies: 106
Views: 32910

10323

Why WA? :roll: [cpp]#include <iostream.h> typedef unsigned long long ULLT; int main() { const ULLT UNDER = 10000LL, OVER = 6227020800LL; ULLT limit, fact, i; while (cin >> limit) { fact = 1; for (i = 1; i <= limit; i++) { fact *= i; if (fact > OVER) { cout << "Overflow!\n"; break; } } if (fact <= OV...
by ec3_limz
Mon Jan 27, 2003 3:09 pm
Forum: Volume 5 (500-599)
Topic: 507 - Jill Rides Again
Replies: 92
Views: 30592

507

Hi. I got TLE for this problem. Apparently an O(N^2) algorithm is far too slow. Can anyone suggest a linear-time algorithm? Thanks. [cpp]#include <stdio.h> int main() { int nroute, route[20001], sum[20001], max, start, end; int cases, tt, i, j; scanf("%d", &cases); for (tt = 1; tt <= cases; tt++) { ...
by ec3_limz
Thu Jan 23, 2003 2:09 pm
Forum: Volume 1 (100-199)
Topic: 116 - Unidirectional TSP
Replies: 226
Views: 37481

Help!

My code works for all the sample test cases provided by hank, but I still get WA. Please help! [cpp]#include <limits.h> #include <stdio.h> #include <stdlib.h> typedef struct T_path { int col[100]; }; int rows, cols; inline int intcmp(const void *a, const void *b) { return *(int*)a - *(int*)b; } int ...
by ec3_limz
Mon Jan 20, 2003 5:50 pm
Forum: Volume 1 (100-199)
Topic: 104 - Arbitrage
Replies: 223
Views: 14796

#104 - Arbitrage (Runtime Error: Invalid memory access)

[cpp]/* @JUDGE_ID: 18472KP 104 C++ "All Pairs Shortest Paths" */ #include <stdio.h> int path[20][20]; void printpath(int src, int pos) { if (src != pos) printpath(src, path[src][pos]); printf("%d ", pos + 1); } int main() { bool arbitrage; double conv[20][20]; int ncurr, i, j, k; while (scanf("%d", ...
by ec3_limz
Sun Jan 12, 2003 5:27 pm
Forum: Volume 6 (600-699)
Topic: 623 - 500!
Replies: 187
Views: 44915

In this problem, you should print out the required output number on ONE SINGLE LINE regardless of how long it is. If you don't believe me, check out http://acm.uva.es/p/v6/623.fix.html
by ec3_limz
Sun Jan 12, 2003 5:17 pm
Forum: Volume 1 (100-199)
Topic: 152 - Tree's a Crowd
Replies: 30
Views: 4018

Hi, 1. The last line of input "0 0 0" should not be considered as a case to check. 2. All coordinates can fit into 32-bit signed integer, with range -2147483648 to 2147483647. 3. There is a maximum of 5000 trees, each with an x, y, and z coordinate. This might help a little. Do NOT consider cases wh...
by ec3_limz
Fri Jan 10, 2003 1:23 pm
Forum: Other words
Topic: acm solve sites
Replies: 51
Views: 26144

Hi, Actually, there are many websites that showcase their respective authors' ACM solutions. I personally feel that it is all right to create such a website. Such a website would then be meant for educational purposes. Cheaters who steal others' solutions and submit them to the online judge without ...
by ec3_limz
Fri Jan 10, 2003 1:10 pm
Forum: Volume 101 (10100-10199)
Topic: 10106 - Product
Replies: 98
Views: 27614

Hi everyone, I have later discovered my mistake. My mistake is that in adding the subtotal, I FORGOT TO CARRY OVER WHEN A DIGIT IS MORE THAN 10. And now I got this problem Accepted :lol: For those of you having trouble with this problem, here is my Accepted source code. [cpp]#include <stdio.h> #incl...
by ec3_limz
Thu Jan 09, 2003 5:02 pm
Forum: Volume 101 (10100-10199)
Topic: 10106 - Product
Replies: 98
Views: 27614

10106

Sorry that I used some very unorthodox array sizes. I tried to simulate long multiplication, but got WA. Can anyone help? [cpp]#include <stdio.h> #include <string.h> char n1[503], n2[503], product[503]; void getdigits(char s1[252], char s2[252]) { int i, j; memset(n1, 0, sizeof(n1)); memset(n2, 0, s...
by ec3_limz
Wed Dec 25, 2002 7:35 am
Forum: Volume 100 (10000-10099)
Topic: 10003 - Cutting Sticks
Replies: 59
Views: 24946

10003

How do I solve #10003: Cutting Sticks using Dynamic Programming (DP)? I have seen others' source code, but I don't understand how and why they work.

Please tell me.

DP is so complicated :(

Go to advanced search