Submission #601789

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6017892022-07-22 10:02:27Minindu2006Arranging Shoes (IOI19_shoes)C++14
85 / 100
1085 ms12436 KiB
#include "shoes.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll count_swaps(vector<int> s)
{
ll n = s.size() / 2;
if (n == 1)
return s[0] > 0;
set<int> st;
int isb4 = 1;
for (int i = 0; i < n; i++)
{
if (s[i] != -s[i + n] || s[i] > 0)
{
isb4 = 0;
break;
}
}
if (isb4)
return n * (n - 1) / 2;
for(int i=0;i<2*n;i++)
st.insert(s[i]);
if (st.size() == 2)
{
vector<int> l;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:9:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    9 |     if (n == 1)
      |     ^~
shoes.cpp:11:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   11 |  set<int> st;
      |  ^~~
shoes.cpp:21:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   21 |     if (isb4)
      |     ^~
shoes.cpp:23:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   23 |  for(int i=0;i<2*n;i++)
      |  ^~~
#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...