제출 #1293041

#제출 시각아이디문제언어결과실행 시간메모리
1293041lukaye_19Arranging Shoes (IOI19_shoes)C++20
45 / 100
14 ms1964 KiB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

ll count_swaps(vector<int>Shoes) {
      ll c1 = 0;
      ll c2 = 0;
      
      ll cnt = 0;
      
      for (ll i = 0; i < Shoes.size(); i++)
      {
        int Shoe = Shoes[i];
        
        if (Shoe < 0)
        {
          cnt += abs(i - c1 * 2);
          c1++;
        }
        else if (Shoe > 0 )
        {
          cnt += abs(i - c2 * 2 - 1);
          c2++;
        }
      }
    
      return cnt/2LL;
  
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...