Submission #14014

#TimeUsernameProblemLanguageResultExecution timeMemory
14014pjsdream이상한 수열 (OJUZ10_bizarre)C++98
Compilation error
0 ms0 KiB
#pragma warning(disable:4996) #include <stdio.h> #include <set> using namespace std; int n, m; int a[50000]; set<int> s; int main() { scanf("%d", &n); for (int i=0; i<n; i++) scanf("%d", &a[i]), s.insert(a[i]); scanf("%d", &m); if (m<=n) { printf("%d\n", a[m-1]); } else { m -= n+1; int b = s.size(); int e; // B_n+1 = b auto it = s.lower_bound(b); if (it == s.end()) e = 2000000000; else e = *it; if (b+m <= e) printf("%d\n", b+m); else printf("%d\n", e); } return 0; }

Compilation message (stderr)

bizarre.cpp:1:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(disable:4996)
 ^
bizarre.cpp: In function ‘int main()’:
bizarre.cpp:28:3: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
   auto it = s.lower_bound(b);
   ^
bizarre.cpp:28:8: error: ‘it’ does not name a type
   auto it = s.lower_bound(b);
        ^
bizarre.cpp:29:7: error: ‘it’ was not declared in this scope
   if (it == s.end()) e = 2000000000;
       ^
bizarre.cpp:13:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
bizarre.cpp:14:60: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  for (int i=0; i<n; i++) scanf("%d", &a[i]), s.insert(a[i]);
                                                            ^
bizarre.cpp:15:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &m);
                 ^