제출 #694855

#제출 시각아이디문제언어결과실행 시간메모리
694855allin27xArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; long long count_swaps(vector<int> S){ long long res = 0; int n = S.size(); vector<int> s(n,0); vector<bool> ac(n,1); for (int i=0; i<n; i++){ if (!ac[i]) continue; for (int j=i+1; j<n; j++){ if (!ac[j] || S[j])!=-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 'long long int count_swaps(std::vector<int>)':
shoes.cpp:13:32: error: expected primary-expression before '!=' token
   13 |             if (!ac[j] || S[j])!=-S[i]) continue;
      |                                ^~