Submission #896990

#TimeUsernameProblemLanguageResultExecution timeMemory
896990ozner77Arranging Shoes (IOI19_shoes)C++17
10 / 100
1067 ms3164 KiB
#include "shoes.h" #include <bits/stdc++.h> #include <vector> #include <iostream> #include <string> using namespace std; long long count_swaps(std::vector<int> s) { int a,b,c,d,e=s.size(),xd,jsjs=0; bool fua=false,fuo=true; long long swaps=0; for(int i=0;i<e;i+=2){ a=s[i]; b=s[i]; for(int j=i;j<e;j++){ if(s[j]<0){ for(int k=j;k<e;k++){ if(s[k]+s[j]==0){ fua=true; xd=k-j; } } if(fua){ if(xd>j-i){ swaps+=(j-i); s[i]=s[j]; s[j]=a; } }else{ swaps++; } } } } return swaps; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:8:8: warning: variable 'b' set but not used [-Wunused-but-set-variable]
    8 |  int a,b,c,d,e=s.size(),xd,jsjs=0;
      |        ^
shoes.cpp:8:10: warning: unused variable 'c' [-Wunused-variable]
    8 |  int a,b,c,d,e=s.size(),xd,jsjs=0;
      |          ^
shoes.cpp:8:12: warning: unused variable 'd' [-Wunused-variable]
    8 |  int a,b,c,d,e=s.size(),xd,jsjs=0;
      |            ^
shoes.cpp:8:28: warning: unused variable 'jsjs' [-Wunused-variable]
    8 |  int a,b,c,d,e=s.size(),xd,jsjs=0;
      |                            ^~~~
shoes.cpp:9:17: warning: unused variable 'fuo' [-Wunused-variable]
    9 |  bool fua=false,fuo=true;
      |                 ^~~
#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...