Submission #14686

# Submission time Handle Problem Language Result Execution time Memory
14686 2015-06-03T12:10:52 Z atomzeno 이상한 수열 (OJUZ10_bizarre) C++
Compilation error
0 ms 0 KB
#include<stdio.h>
#include<algorithm>
#define N 100002
__int64 n,m,a[N],nn=1,b[N],mm;
int main(){
	int i,j;
	scanf("%I64d",&n);
	for(i=1;i<=n;i++){scanf("%I64d",&a[i]);}
	scanf("%I64d",&m);
	if(m<=n){
		printf("%d",a[m]);
	}
	else{
		m=m-n;
		std::sort(a+1,a+n+1);
		for(i=2;i<=n;i++){
			if(a[i-1]!=a[i]){
				nn++;
				b[nn]=a[i];
			}
		}
		b[nn+1]=21000000000;
		int g;
		b[0]=-21000000000;
		for(i=1;i<=nn+1;i++){
			if(b[i-1]<nn&&nn<=b[i]){
				g=i;
				break;
			}
		}
		nn+=(m-1);
		if(nn>=b[g]){
			printf("%I64d",b[g]);
		}
		else{
			printf("%I64d",nn);
		}
	}
}

Compilation message

bizarre.cpp:4:1: error: ‘__int64’ does not name a type
 __int64 n,m,a[N],nn=1,b[N],mm;
 ^
bizarre.cpp: In function ‘int main()’:
bizarre.cpp:7:17: error: ‘n’ was not declared in this scope
  scanf("%I64d",&n);
                 ^
bizarre.cpp:8:35: error: ‘a’ was not declared in this scope
  for(i=1;i<=n;i++){scanf("%I64d",&a[i]);}
                                   ^
bizarre.cpp:9:17: error: ‘m’ was not declared in this scope
  scanf("%I64d",&m);
                 ^
bizarre.cpp:11:15: error: ‘a’ was not declared in this scope
   printf("%d",a[m]);
               ^
bizarre.cpp:15:13: error: ‘a’ was not declared in this scope
   std::sort(a+1,a+n+1);
             ^
bizarre.cpp:18:5: error: ‘nn’ was not declared in this scope
     nn++;
     ^
bizarre.cpp:19:5: error: ‘b’ was not declared in this scope
     b[nn]=a[i];
     ^
bizarre.cpp:22:3: error: ‘b’ was not declared in this scope
   b[nn+1]=21000000000;
   ^
bizarre.cpp:22:5: error: ‘nn’ was not declared in this scope
   b[nn+1]=21000000000;
     ^
bizarre.cpp:6:8: warning: unused variable ‘j’ [-Wunused-variable]
  int i,j;
        ^