Submission #15640

#TimeUsernameProblemLanguageResultExecution timeMemory
15640ggoh버블 정렬 (OJUZ10_bubblesort)C++98
Compilation error
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]); } }

Compilation message (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]);
                          ^