Restricted function, HELP !!!

Post here if you don't find any other place for your post. But please, stay on-topic: algorithms, programming or something related to this web site and its services.

Moderator: Board moderators

Post Reply
kcph007
New poster
Posts: 7
Joined: Tue Nov 26, 2002 12:13 pm

Restricted function, HELP !!!

Post by kcph007 »

Here is what I got the error RESTRICTED FUNCTION, can anyone tell me the reason?

[cpp]
#include <iostream.h>
#include <stdlib.h>
#include <vector>
#include <string.h>

enum{
infinity = 100000
};

int m,n;
int a[101][101];
int start, end, n_passenger;

int min(int a, int b){
return (a<b)?a:b;
}

int findTheBestPath(){
vector<bool> marked(n+1,false);
vector<int> distance(n+1,0);
bool found(false) , stop(false);
distance[start] = infinity;
while ( !found && !stop ){
int max = 0, u,v;
for (int i = 1;i<=n ; i++)
if ( distance > max && !marked){
u = i;
max = distance;
}
stop = max == 0;
if (stop) break;
marked = true;
found = u == end;
if (found) break;
for (v=1;v<=n;v++)
if (distance[v] < min(distance,a[v]) ){
distance[v] = min(distance,a[v]);
}
}
return (marked[end])?distance[end]:0;
}

int main()
{
int testNo = 0;
cin >> n >> m;
while (m > 0 && n > 0){
memset(a,0,sizeof(a));
for (int k=1; k<=m;k++){
int i,j,w;
cin >> i >> j >> w;
a[j] = w;
a[j] = w;
}
cin >> start >> end >> n_passenger ;
int t = findTheBestPath() - 1;

cout << "Scenario #" << ++testNo << endl;
cout << "Minimum Number of Trips = " << (n_passenger-1) / t + 1 << endl;
cin >> n >> m;
}
system("PAUSE");
return 0;
}
[/cpp]
[/cpp]
Grow
New poster
Posts: 4
Joined: Fri Mar 22, 2002 2:00 am
Location: Poland

Post by Grow »

system("PAUSE");

this function is restricted... you forgot to remove it from your code... or you want to get "Time Limit Exceeded":)
kcph007
New poster
Posts: 7
Joined: Tue Nov 26, 2002 12:13 pm

Post by kcph007 »

oh my godness , thanks !
Post Reply

Return to “Other words”