Submission #15640

# Submission time Handle Problem Language Result Execution time Memory
15640 2015-07-13T19:40:28 Z ggoh 버블 정렬 (OJUZ10_bubblesort) C++
Compilation error
0 ms 0 KB
#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

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