I have tried all the test cases but still wrong answer . plz help . Here is my code . I have used prims algorithm .
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb(x) push_back(x)
#define MAX 210
#define initialize(a,b,c) for(int i=0;i<c;i++)a[i] = b
#define mem(x,y ...
Search found 3 matches
- Wed Apr 09, 2014 1:46 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10048 - Audiophobia
- Replies: 27
- Views: 14866
- Sun Dec 08, 2013 12:05 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10038 - Jolly Jumpers
- Replies: 445
- Views: 152649
Re: 10038 - Jolly Jumpers
For the input 3 1 3 6 the answer is jolly I think . After having some trouble I figure out one just have to check absolute difference is 1 or not .
- Thu Nov 28, 2013 2:06 pm
- Forum: Volume 6 (600-699)
- Topic: 621 - Secret Research
- Replies: 45
- Views: 27720
Re: 621 - Secret Research
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
string str;
int T,i,len;
char *arr;
while(cin>>T){
cin.ignore();
for(i=1;i<=T;i++){
getline(cin,str);
len = str.length();
arr = new char[len];
strcpy(arr,str.c_str());
if( ( ( arr[0] == '1' ) && ( len==1 ...
#include <string.h>
using namespace std;
int main()
{
string str;
int T,i,len;
char *arr;
while(cin>>T){
cin.ignore();
for(i=1;i<=T;i++){
getline(cin,str);
len = str.length();
arr = new char[len];
strcpy(arr,str.c_str());
if( ( ( arr[0] == '1' ) && ( len==1 ...