제출 #474100

#제출 시각아이디문제언어결과실행 시간메모리
474100ValiAntonieArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; long long count_swaps(vector<int> v){ indice = -1; int i = 0, nr = 0, numar = 0, j = 0, j2 = 0; for(i=indice;i<=n;i++){ if(v[i] < 0){ indice++; numar = -v[i]; for(j=i;j>indice;j--){ swap(v[j],v[j-1]); nr++; } indice++; for(j2=1;j2<=n;j2++){ if(v[j2] == numar){ for(j=i;j>indice;j--){ swap(v[j],v[j-1]); nr++; } } } i = indice; } } return nr; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:5:1: error: 'indice' was not declared in this scope
    5 | indice = -1;
      | ^~~~~~
shoes.cpp:7:17: error: 'n' was not declared in this scope
    7 | for(i=indice;i<=n;i++){
      |                 ^