제출 #1317280

#제출 시각아이디문제언어결과실행 시간메모리
1317280belmostefaArranging Shoes (IOI19_shoes)C++20
컴파일 에러
0 ms0 KiB
#include<vector> using namespace std; long long c=0; long long count_swaps(vector<int>S){ int l=0,r=0; while(l<n){ r++; int k=-1*S[l]; if(k==S[r]){ c+=r-l-1; for(int i=r;i>l+1;i--){ swap(S[i],S[i-1]); } if(S[l]>0){ c++; swap(S[l],S[l+1]); } l+=2; r=l; } } return c; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:6:10: error: 'n' was not declared in this scope
    6 |  while(l<n){
      |          ^