Submission #4899

# Submission time Handle Problem Language Result Execution time Memory
4899 2014-01-07T06:45:09 Z gs13068 medians (balkan11_medians) C++
15 / 100
36 ms 1408 KB
#include<cstdio>

bool exist[300000];

int main()
{
	int l,r,bef;
	int i,t,n;
	scanf("%d",&n);
	l=1;r=2*n-1;
	scanf("%d",&t);
	printf("%d",t);
	exist[t]=true;
	bef=t;
	for(i=1;i<n;i++)
	{
		scanf("%d",&t);
		if(!exist[t])
		{
			exist[t]=true;
			printf(" %d",t);
			if(t<bef)
			{
				while(exist[l])l++;
				exist[l]=true;
				printf(" %d",l);
			}
			else
			{
				while(exist[r])r--;
				exist[r]=true;
				printf(" %d",r);
			}
		}
		else
		{
			while(exist[l])l++;
			exist[l]=true;
			printf(" %d",l);
			while(exist[r])r--;
			exist[r]=true;
			printf(" %d",r);
		}
		bef=t;
	}
}

Compilation message

medians.cpp: In function 'int main()':
medians.cpp:9:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
medians.cpp:11:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&t);
                ^
medians.cpp:17:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&t);
                 ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1408 KB Output is correct
2 Incorrect 0 ms 1408 KB Output isn't correct
3 Correct 0 ms 1408 KB Output is correct
4 Incorrect 0 ms 1408 KB Output isn't correct
5 Incorrect 0 ms 1408 KB Output isn't correct
6 Correct 0 ms 1408 KB Output is correct
7 Incorrect 0 ms 1408 KB Output isn't correct
8 Incorrect 0 ms 1408 KB Output isn't correct
9 Incorrect 0 ms 1408 KB Output isn't correct
10 Incorrect 0 ms 1408 KB Output isn't correct
11 Incorrect 0 ms 1408 KB Output isn't correct
12 Incorrect 0 ms 1408 KB Output isn't correct
13 Incorrect 0 ms 1408 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1408 KB Output isn't correct
2 Incorrect 0 ms 1408 KB Output isn't correct
3 Incorrect 0 ms 1408 KB Output isn't correct
4 Incorrect 3 ms 1408 KB Output isn't correct
5 Incorrect 16 ms 1408 KB Output isn't correct
6 Incorrect 19 ms 1408 KB Output isn't correct
7 Incorrect 36 ms 1408 KB Output isn't correct