제출 #888560

#제출 시각아이디문제언어결과실행 시간메모리
888560Lincito_31Arranging Shoes (IOI19_shoes)C++14
0 / 100
2 ms600 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long count_swaps(vector<int> s) { long long x; while(!s.empty()){ int i=0; if(s[i]<0 && s[i]==-s[i+1]){ vector<int> ant(s.begin()+3,s.end()); s=ant; } while(s[i]>0){ i++; } x+=i; int abso=-1*s[i]; vector<int> ant(s.begin(),s.begin()+i); vector<int> pos(s.begin()+i+1,s.end()); ant.insert(ant.end(),pos.begin(),pos.end()); s=ant; i=0; while(s[i]!=abso){ i++; } x+=i; vector<int> ante(s.begin(),s.begin()+i); vector<int> post(s.begin()+i+1,s.end()); ante.insert(ante.end(),post.begin(),post.end()); s=ante; } return x; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:31:9: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |  return x;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...