제출 #826627

#제출 시각아이디문제언어결과실행 시간메모리
826627AlesL0Arranging Shoes (IOI19_shoes)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; typedef long long ll; ll sol = 0; void solve(ll i, vector <int> &s){ if (i < 0)return; if (s[i] > 0){ ll ind; for (int j = i-1; j >= 0; j--){ if (s[j] == -s[i]){ ind = j; break; } } for (int j = ind; j < i-1; j++){ swap(s[j], s[j+1]); sol++; } solve(i-2, s); } else { ll ind; for (int j = i-1; j >= 0; j--){ if (s[j] > 0){ ind = j; break; } } for (int j = ind; j < i-1; j++){ swap(s[j], s[j+1]); sol++; } solve(i, s); } } long long count_swaps(std::vector<int> s) { solve(s.size()-1, s); }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:44:1: warning: no return statement in function returning non-void [-Wreturn-type]
   44 | }
      | ^
shoes.cpp: In function 'void solve(ll, std::vector<int>&)':
shoes.cpp:20:12: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |   for (int j = ind; j < i-1; j++){
      |            ^
shoes.cpp:34:12: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |   for (int j = ind; j < i-1; j++){
      |            ^
#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...