Got runtime error. Please help me, thanks.
My approach is tarjan's algorithm. (SCC)
Then count the number of SCC whose in-degree is 0.
I ran through thousands of cases on my computer, but none crashed.
Got AC.
The reason of RE was stack overflow.
I created 100,000 vectors and int arrays ...
Search found 60 matches: 11504
Searched query: 11504
- Fri Aug 21, 2015 7:35 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
- Wed Feb 11, 2015 2:55 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
I got AC! Thank you so much brianfry!brianfry713 wrote:ree975, read this thread.
Jinming, instead of vector<vector<int> > graph(n), use a global vector<int> graph[100000], clear it between test cases, and you will get AC.
- Tue Feb 10, 2015 2:21 am
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
ree975, read this thread.
Jinming, instead of vector<vector<int> > graph(n), use a global vector<int> graph[100000], clear it between test cases, and you will get AC.
Jinming, instead of vector<vector<int> > graph(n), use a global vector<int> graph[100000], clear it between test cases, and you will get AC.
- Mon Feb 09, 2015 6:39 am
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
Hi, I passed all the inputs in this thread, but I keep getting RTE in the OJ. Please help me!
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void explore(vector<vector<int> > &graph, vector<bool> &visited, vector<int> &post, int n, int v, int &clock){
visited[v ...
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void explore(vector<vector<int> > &graph, vector<bool> &visited, vector<int> &post, int n, int v, int &clock){
visited[v ...
- Sun Feb 08, 2015 12:19 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
I could pass the input on the board, but getting TLE.
Using Tarjan's algorithm find for SCC and use adjacent nodes to count InDeg.
Any advice will be appreciated! thanks!
(comment code is that I tried to use map instead of bool[] to save some time, but seems in vain)
#include<iostream>
#include ...
Using Tarjan's algorithm find for SCC and use adjacent nodes to count InDeg.
Any advice will be appreciated! thanks!
(comment code is that I tried to use map instead of bool[] to save some time, but seems in vain)
#include<iostream>
#include ...
- Wed Dec 24, 2014 12:31 am
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
Input: 100
89384 86
73028 22202
21872 59426
5 76035
29766 57218
76556 57267
57804 7315
82703 59996
28955 18709
58249 4805
39729 56068
57550 3520
74843 24407
15348 23551
62824 47452
87747 34898
24051 80311
17304 38342
24993 45922
13755 73644
41526 21710
29024 57262
84210 66281
84989 78679
83483 80116 ...
89384 86
73028 22202
21872 59426
5 76035
29766 57218
76556 57267
57804 7315
82703 59996
28955 18709
58249 4805
39729 56068
57550 3520
74843 24407
15348 23551
62824 47452
87747 34898
24051 80311
17304 38342
24993 45922
13755 73644
41526 21710
29024 57262
84210 66281
84989 78679
83483 80116 ...
- Thu Dec 18, 2014 12:35 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
Why below code is getting WA? Need help
#include<stdio.h>
#include<iostream>
#define MAX 100000
#include <vector>
#include<queue>
using namespace std;
vector<int>edges[MAX];
int visited[MAX]={0};
int level[MAX]={0};
int parent[MAX];
void BFS(int n, int src)
{
//int visited[100]={0 ...
#include<stdio.h>
#include<iostream>
#define MAX 100000
#include <vector>
#include<queue>
using namespace std;
vector<int>edges[MAX];
int visited[MAX]={0};
int level[MAX]={0};
int parent[MAX];
void BFS(int n, int src)
{
//int visited[100]={0 ...
- Tue Sep 30, 2014 9:16 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
http://www.udebug.com/UVa/11504
Click "Critical Input", "Go!"
Click "Critical Input", "Go!"
- Tue Sep 30, 2014 4:19 am
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
No reply... 
I am stuck in this problem.

I am stuck in this problem.
- Sat Sep 27, 2014 8:43 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
WA :(
Tested with all the inputs found in this thread. My program gives the correct output for all the inputs.
Here is my code.
#include<iostream>
#include<cstdio>
#include<vector>
#include<stack>
using namespace std;
int index;
int scc;
int result;
class Node {
public:
vector<int> adj;
int ...
Tested with all the inputs found in this thread. My program gives the correct output for all the inputs.
Here is my code.
#include<iostream>
#include<cstdio>
#include<vector>
#include<stack>
using namespace std;
int index;
int scc;
int result;
class Node {
public:
vector<int> adj;
int ...
- Mon Aug 11, 2014 11:10 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
OK, so I made an implementation of Tarjan's algorithm for finding SCCs and if I have an edge from a node to SCC in which it doesn't belong then I do not count that SCC. I tested it on all inputs in the topic and got correct outputs but for some reason i get Runtime Error on the judge. Any Ideas? Btw ...
- Fri Dec 06, 2013 9:59 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
Try the I/O in this thread.
- Fri Dec 06, 2013 12:49 am
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
prooblem: Domino
ID:11504
Why getting wrong answer?? Please help...
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<cstring>
using namespace std;
int main()
{
int cases,len,n,count,l,m,temp,temp2,top;
vector<int>v[100010];
vector<int> done;
bool ...
ID:11504
Why getting wrong answer?? Please help...
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<cstring>
using namespace std;
int main()
{
int cases,len,n,count,l,m,temp,temp2,top;
vector<int>v[100010];
vector<int> done;
bool ...
- Wed Dec 04, 2013 12:19 am
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
Input:AC output 2
Code: Select all
1
10 13
1 2
2 1
3 4
4 3
5 6
6 5
7 8
8 7
9 10
10 9
4 6
5 10
10 1
- Thu Nov 28, 2013 8:44 am
- Forum: Volume 115 (11500-11599)
- Topic: 11504 - Dominos
- Replies: 55
- Views: 33682
Re: 11504 - Dominos
Brian fry,
My code outputs all the cases posted by you perfectly. But still WA.
#include<cstdio>
#include<queue>
#include<vector>
#include<cstring>
using namespace std;
int no_of_connections, no_of_tiles, count_1 = 0;
char color[100050];
vector<int>data[100050];
void read_input(void);
void ...
My code outputs all the cases posted by you perfectly. But still WA.
#include<cstdio>
#include<queue>
#include<vector>
#include<cstring>
using namespace std;
int no_of_connections, no_of_tiles, count_1 = 0;
char color[100050];
vector<int>data[100050];
void read_input(void);
void ...