Search found 9 matches

by mehrab2603
Mon Aug 31, 2015 3:20 pm
Forum: Volume 122 (12200-12299)
Topic: 12276 - Assembly line
Replies: 0
Views: 6249

Re: 12276 - Assembly line

Getting WA. May I get some test cases. #include <bits/stdc++.h> using namespace std; const int MAX = 30; struct Return { int time, serial; Return() {} Return(int time, int serial) { this->time = time; this->serial = serial; } }; int symbols[MAX], revSymbols[MAX]; int timeNeeded[MAX][MAX], transforms...
by mehrab2603
Mon Aug 24, 2015 10:24 am
Forum: Volume 119 (11900-11999)
Topic: 11906 - Knight in a War Grid
Replies: 13
Views: 7763

Re: 11906 - Knight in a War Grid

Getting WA. May I get some test cases?
Edit: solved :D

Code: Select all

//code removed after AC
by mehrab2603
Wed Jan 14, 2015 4:08 pm
Forum: Volume 12 (1200-1299)
Topic: 1231 - ACORN
Replies: 3
Views: 1501

Re: 1231 - ACORN

Thanks for the hint. I'll try it again.
However, I was wondering why my code gets TLE while this one gets AC. Seems similar to mine. Just wanted to understand how the complexity was improved.

*code removed*
by mehrab2603
Mon Jan 12, 2015 2:33 pm
Forum: Volume 12 (1200-1299)
Topic: 1231 - ACORN
Replies: 3
Views: 1501

Re: 1231 - ACORN

Getting TLE. Any help on how to make it efficient will be highly appreciated. #include <bits/stdc++.h> using namespace std; int t, h, f; //vector<int> acorn[2010]; int acorn[2010][2010]; int dp[2010][2010]; bool vis[2010][2010]; int func(int, int); int main() { int c; scanf("%d", &c); while(c--) { s...
by mehrab2603
Thu Jan 01, 2015 9:57 am
Forum: Volume 110 (11000-11099)
Topic: 11034 - Ferry Loading IV
Replies: 15
Views: 6956

Re: 11034 - Ferry Loading IV

Getting WA :( Please provide some test cases. #include <bits/stdc++.h> using namespace std; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int t; scanf("%d", &t); getchar(); while(t--) { int l, m; scanf("%d %d", &l, &m); getchar(); if(m == 0) {printf("0\n"); c...
by mehrab2603
Mon Apr 07, 2014 3:18 pm
Forum: Volume 3 (300-399)
Topic: 314 - Robot
Replies: 30
Views: 6689

Re: 314, Robot, Help!

Getting WA. Please help! #include <bits/stdc++.h> #define MAX 55 using namespace std; void trans(int, int); int m, n, mat[MAX][MAX], mat2[MAX][MAX]; struct square{int x, y, dir; square() {} square(int a, int b) {x = a; y = b;} square(int a, int b, int c) {x = a; y = b; dir = c;}}; map<string, int> m...
by mehrab2603
Tue Apr 01, 2014 6:45 am
Forum: Volume 101 (10100-10199)
Topic: 10199 - Tourist Guide
Replies: 57
Views: 31446

Re: 10199 - Tourist Guide

Ok I got rid of those loops, and used another array which keeps track of how many time dfs has been called from a node. If dfs has been called more than 1 time from a source node, then the node is an articulation point. Found some other errors that were causing TLE and fixed them. Now getting WA. co...
by mehrab2603
Tue Apr 01, 2014 3:22 am
Forum: Volume 101 (10100-10199)
Topic: 10199 - Tourist Guide
Replies: 57
Views: 31446

Re: 10199 - Tourist Guide

Trying to determine if the source node is an articulation point or not. If the finishing time of the first adjacent node of the source node is less than the discovery time of any of the the next adjacent nodes, it is an articulation point. Don't know how I can achieve this faster in this way, have t...
by mehrab2603
Sun Mar 30, 2014 6:58 pm
Forum: Volume 101 (10100-10199)
Topic: 10199 - Tourist Guide
Replies: 57
Views: 31446

Re: 10199 - Tourist Guide

I'm using DFS to find articulation points, but getting TLE. Please help! #include <bits/stdc++.h> #define MAX 101 using namespace std; map<string, int> mymap; vector<int> adj[MAX]; vector<int> apoints; int col[MAX], par[MAX], low[MAX], dis[MAX], fin[MAX], tim, n; void dfs(); void dfs_visit(int); int...

Go to advanced search