제출 #15640

#제출 시각아이디문제언어결과실행 시간메모리
15640ggoh버블 정렬 (OJUZ10_bubblesort)C++98
컴파일 에러
0 ms0 KiB
#include<cstdio> #include<set> int a,b,i,x[160001]; std::multiset<int>S; main() { scanf("%d%d",&a,&b); for(i=0;i<a;i++) { scanf("%d",&x[i]); if(i<=b)S.insert(x[i]); } for(i=0;i<a;i++) { std::multiset<int>iterator t=S.begin(); printf("%d ",*t); S.erase(t); if(i+b+1<a)S.insert(x[i+b+1]); } }

컴파일 시 표준 에러 (stderr) 메시지

bubblesort.cpp:5:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main()
      ^
bubblesort.cpp: In function ‘int main()’:
bubblesort.cpp:15:33: error: expected initializer before ‘t’
      std::multiset<int>iterator t=S.begin();
                                 ^
bubblesort.cpp:16:20: error: ‘t’ was not declared in this scope
      printf("%d ",*t);
                    ^
bubblesort.cpp:7:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&a,&b);
                        ^
bubblesort.cpp:10:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x[i]);
                          ^