제출 #694852

#제출 시각아이디문제언어결과실행 시간메모리
694852allin27xArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; using ll = long long int; ll count_swaps(vector<ll> S){ ll res = 0; ll n = S.size(); vector<ll> s(n,0); vector<bool> ac(n,1); for (ll i=0; i<n; i++){ if (!ac[i]) continue; for (ll j=i+1; j<ni; j++){ if (!ac[j] || abs(S[j])!=abs(S[i])) continue; ac[j] = 0; ac[i] = 0; if (S[i]<0) res+=j-i-1; else res+=j-i; break; } } return res; }

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

shoes.cpp: In function 'll count_swaps(std::vector<long long int>)':
shoes.cpp:12:26: error: 'ni' was not declared in this scope; did you mean 'i'?
   12 |         for (ll j=i+1; j<ni; j++){
      |                          ^~
      |                          i