Submission #199098

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1990982020-01-29 10:26:16redaArranging Shoes (IOI19_shoes)C++14
65 / 100
1092 ms2172 KiB
#include<bits/stdc++.h>
#define ll long long
#pragma GCC optimize ("Ofast","unroll-loops")
using namespace std;
#define all(x) x.begin(),x.end()
#define pb push_back
const ll MAXN = 1e5 + 4 ;
long long count_swaps (vector<int>s)
{
ll n = s.size();
bool c=1;
long long ans = 0 ;
n=n/2LL;
for(int i = 0 ;i<n;i++)
{
if(s[i]!=-1*s[i+n] || s[i]>0){c=0;break;}
}
if(c){
return (ll)n*(n-1)/2LL;
}
for(int i = 0 ;i < s.size();i+=2)
{
int j = i+1;
while(s[i]!=-s[j])
{
j++;
}
while (j!=i+1)
{
swap(s[j],s[j-1]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:21:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i = 0 ;i < s.size();i+=2)
                      ~~^~~~~~~~~~
#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...