Submission #759827

#TimeUsernameProblemLanguageResultExecution timeMemory
759827ivazivaArranging Shoes (IOI19_shoes)C++14
25 / 100
20 ms4692 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; #define MAXN 200010 long long n; long long niz[MAXN]; long long count_swaps(vector<int> s) { n=s.size()/2; for (long long i=0;i<s.size();i++) niz[i+1]=s[i]; if (n==1) { ///test1 if (niz[1]<niz[2]) return 0; else return 1; } long long br=0; for (long long i=1;i<=n;i++) { if (abs(niz[i])==abs(niz[i+n])) br++; } if (br==n) { ///test4 return ((n-1)*n)/2; } }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:14:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for (long long i=0;i<s.size();i++) niz[i+1]=s[i];
      |                        ~^~~~~~~~~
shoes.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^
#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...