Page 2 of 3

Re: 11850-Alaska

Posted: Wed Feb 15, 2012 12:13 am
by brianfry713
Input:

Code: Select all

8
400
1200
800
0
600
1400
200
1000
0
AC output:

Code: Select all

POSSIBLE

Re: 11850-Alaska

Posted: Sat Feb 18, 2012 5:54 am
by uvasarker
Hi
Boss,
I updated more. But
Still WA. Please help me. Here is my code:

Code: Select all

/* Removed */ AC

Re: 11850-Alaska

Posted: Mon Oct 01, 2012 5:43 pm
by @li_kuet
Try this Input :

Code: Select all

8
0
200
400
600
800
900
1100
1300
0
Output :

Code: Select all

IMPOSSIBLE

Re: 11850-Alaska

Posted: Sun Feb 10, 2013 4:15 pm
by omarking05
hey ..
can anybody tell me please whats wrong with my code ?

Code: Select all

#include <iostream> 
using namespace std; 

int main ()
{
	int n , lo[1430],count=1;
	while(cin>>n&&n!=0)
	{
		count=1;
		for (int i=0;i<n;i++)
		{
			cin>>lo[i];
		}
		for (int j=0;j<n;j++)
		{

				if (lo[j]>lo[j+1])
				{
					if (lo[j]-lo[j+1]<=200)
						count++;
					cout<<count<<endl;
				}
				else if (lo[j]<lo[j+1])
				{
					if (lo[j+1]-lo[j]<=200)
						count++;
				}
		}
		if (count==n) cout<<"POSSIBLE"<<endl;
		else cout<<"IMPOSSIBLE"<<endl;
	}
	return 0;
} 
thanks in advance ..

Re: 11850-Alaska

Posted: Mon Feb 11, 2013 11:05 pm
by brianfry713
Don't print count.

Re: 11850-Alaska

Posted: Sun Mar 03, 2013 9:46 am
by milan_aiub
8
0
200
400
600
800
900
1100
1300
0
Why the output of this case is "IMPOSSIBLE" ?

Re: 11850-Alaska

Posted: Mon Mar 04, 2013 11:17 pm
by brianfry713
She can't make it from the station at 1300 miles to Delta Junction at 1422 miles and back to the station at 1300 miles.

Re: 11850-Alaska

Posted: Thu Feb 06, 2014 1:45 pm
by MNT.95
I don't get the point of coming back ??
I sort them then I check the difference between them, every test case I run in my program is correct, so why I got WA?

Re: 11850-Alaska

Posted: Thu Feb 06, 2014 11:10 pm
by brianfry713
You can't assume there is a charging station at Delta Junction.

Re: 11850-Alaska

Posted: Sat Mar 29, 2014 12:43 pm
by ultima_key

Code: Select all

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
	int s;
	while(cin >> s){
		if(s == 0) break;
		int station[s];
		bool conse = true;
		for(int i = 0; i < s; i++) cin >> station[i];
		sort(station, station+s);
		for(int i = 0; i < s-1; i++){
			if(abs(station[i]-station[i+1]) != 200){
				conse = false;
				break;
			}
		}
		if(conse) cout << "POSSIBLE" << endl;
		else cout << "IMPOSSIBLE" << endl;
	}
}
Why is my code returning a WA verdict? Every input I saw here was correct.

Re: 11850-Alaska

Posted: Tue Apr 01, 2014 1:57 am
by brianfry713
Input:

Code: Select all

8
1399
1200
1000
800
600
400
200
0
0
AC output: POSSIBLE

Re: 11850-Alaska

Posted: Tue Apr 01, 2014 9:52 am
by uDebug
Replying to follow the thread.

11850-Alaska

Posted: Sun Jul 20, 2014 12:16 am
by Shahidul.CSE
Why WA with my code ?

Code: Select all

#include<stdio.h>
int main()
{
    long long int n, i,j, station[1435],temp,flag;
    while(scanf("%lld",&n) && n!=0)
    {
        flag=1;
        for(i=0;i<n;i++)
            scanf("%lld",&station[i]);
        for(i=0;i<n;i++)
          {
            for(j=0;j<n-1;j++)
            if(station[j]<station[j+1])
            {
                temp=station[j];
                station[j]=station[j+1];
                station[j+1]=temp;
            }
          }
            for(i=0;i<n-1;i++)
                {
                    if((station[i]-station[i+1])>200)
                    {
                        flag=0;
                        break;
                    }
                }
                if(flag==0)
                    printf("IMPOSSIBLE\n");
                else if(flag==1)
                    printf("POSSIBLE\n");
    }
    return 0;
}


Re: 11850-Alaska

Posted: Sun Jul 20, 2014 12:47 pm
by lighted
The problem description says:
Can Brenda drive her car from Dawson City to Delta Juntion and back?
Try input

Code: Select all

8
1300
1200
1000
800
600
400
200
0
0
Correct output is

Code: Select all

IMPOSSIBLE

Re: 11850-Alaska

Posted: Sun Jul 20, 2014 3:12 pm
by Shahidul.CSE
For above input, how the output be

Code: Select all

IMPOSSIBBLE
please explain it.