This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define OYY LLONG_MAX
#define mod 1000000007
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define lim 300005
#define fi first
#define se second
long long count_swaps(std::vector<int> s) {
int n=s.size();
if(n==2){
if(s[0]<0)return 0;
return 1;
}
int tut=1,cev=0;
FOR{
if(s[i-1]<0){
cev+=abs(tut-i);
tut+=2;
}
}
return cev;
}
/*
int main(){
faster
int n;cin>>n;
vector<int> v;
FOR{
int x,y;
cin>>x>>y;
v.push_back(x);
v.push_back(y);
}
cout<<count_swaps(v)<<'\n';
return 0;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |