제출 #232425

#제출 시각아이디문제언어결과실행 시간메모리
232425jam_xd_Arranging Shoes (IOI19_shoes)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main() { int tamano; cin>>tamano; deque<int>s(tamano); for(int i=0;i<tamano;i++){ cin>>s[i]; } int contador=0; int swaps = 0; int aux; for(int i=0;i<s.size();i++){ if((s[i] > 0 && i%2 == 0 && i!= 0) or (s[0] > 0 && i==0)){ for(int j=i;j<s.size();j++){ contador++; if(s[j] < 0 && j%2==0){ swaps = swaps + contador; aux = s[i]; s[i] = s[j]; s[j] = aux; contador = 0; break; } } } if(s[i] < 0 && i%2 != 0){ for(int k=i;k<s.size();k++){ contador++; if(s[k] > 0 && k%2==0 && i!= 0){ swaps = swaps + contador; aux = s[i]; s[i] = s[k]; s[k] = aux; contador = 0; break; } } } } cout<<swaps<<endl; return 0; }

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

shoes.cpp: In function 'int main()':
shoes.cpp:21:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<s.size();i++){
              ~^~~~~~~~~
shoes.cpp:23:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j=i;j<s.size();j++){
                ~^~~~~~~~~
shoes.cpp:37:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int k=i;k<s.size();k++){
                ~^~~~~~~~~
/tmp/ccuqoYrL.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccQgCRGE.o:shoes.cpp:(.text.startup+0x0): first defined here
/tmp/ccuqoYrL.o: In function `main':
grader.cpp:(.text.startup+0x282): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status