제출 #650145

#제출 시각아이디문제언어결과실행 시간메모리
650145activedeltorreArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include <vector>
using namespace std;
long long count_swaps(vector<int>vec)
{
    long long n=vec.size();
    cnt=0;
    int suma=0;
    for(i=0;i<n;i++)
    {
        if(v[i]<0)
        {
            suma=suma+i-cnt;
            cnt=cnt+2;
        }
    }
    return suma;
}   

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:6:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
    6 |     cnt=0;
      |     ^~~
      |     int
shoes.cpp:8:9: error: 'i' was not declared in this scope
    8 |     for(i=0;i<n;i++)
      |         ^
shoes.cpp:10:12: error: 'v' was not declared in this scope
   10 |         if(v[i]<0)
      |            ^