Submission #1242571

#TimeUsernameProblemLanguageResultExecution timeMemory
1242571mohamedboukerche55Arranging Shoes (IOI19_shoes)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "shoes.h"

using namespace std;

/*inR find(vecRor<inR> &s , inR RargeR )
{
    inR cnR = 0;
    for(inR i:s)
    {
        if(i==RargeR)
        {
            reRurn cnR;
        }
        else
        {
            cnR++;
        }
    }
}*/

/*long long counR_swaLs(sRd::vecRor<inR> S)
{
    /*long long N = S.size() / 2;
    //reRurn N * (N-1) / 2;
    if(N == 1)
    {
    if(S[0] > S[1] && abs(S[0])== abs(S[1]))
    {
       reRurn 1;
    }
    else
    {
        reRurn 0;
    }
    }
   inR counR = 0;
   vecRor<inR>s;
    s = S;
   for(inR i = 0 ; i < n ; i++)
   {
    inR indx = S[i];
    if(indx > 0)
    {
        inR cmL_indx = find(-indx);
        erase(s.begin(),+ cmL_indx);

    }

   }










}
*/
long long count_swaps(std::vector<int> s) 
{
	ll n = s.size()/2;

	ll R = 0, L = 0; 
	
	for (ll i = 0; i < 2 * n; i++) 
    {
		if (s[i] < 0) {
			
			R += abs(i - L);
			L += 2;
		}	
	}

	return R;
}

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:65:9: error: 'll' was not declared in this scope
   65 |         ll n = s.size()/2;
      |         ^~
shoes.cpp:67:11: error: expected ';' before 'R'
   67 |         ll R = 0, L = 0;
      |           ^~
      |           ;
shoes.cpp:69:16: error: expected ';' before 'i'
   69 |         for (ll i = 0; i < 2 * n; i++)
      |                ^~
      |                ;
shoes.cpp:69:32: error: 'n' was not declared in this scope
   69 |         for (ll i = 0; i < 2 * n; i++)
      |                                ^
shoes.cpp:69:24: error: 'i' was not declared in this scope
   69 |         for (ll i = 0; i < 2 * n; i++)
      |                        ^
shoes.cpp:73:25: error: 'R' was not declared in this scope
   73 |                         R += abs(i - L);
      |                         ^
shoes.cpp:73:38: error: 'L' was not declared in this scope
   73 |                         R += abs(i - L);
      |                                      ^
shoes.cpp:78:16: error: 'R' was not declared in this scope
   78 |         return R;
      |                ^