Submission #957746

#TimeUsernameProblemLanguageResultExecution timeMemory
957746surenArranging Shoes (IOI19_shoes)C++14
50 / 100
1085 ms3268 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mk make_pair #define S second #define F first using namespace std; long long count_swaps(std::vector<int> a) { ll ans = 0, srch; for(int i = 0; i < a.size(); i ++ ){ if( a[i] == 0 ) continue; for(int j = i+1; j < a.size(); j ++ ){ if( a[j] == -a[i] ){ ans += j-i; if( a[i] < 0 ) ans --; a[j] = 0; break; } if( a[j] == 0 ){ ans --; } } } return ans; }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:12:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for(int i = 0; i < a.size(); i ++ ){
      |                 ~~^~~~~~~~~~
shoes.cpp:15:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   for(int j = i+1; j < a.size(); j ++ ){
      |                    ~~^~~~~~~~~~
shoes.cpp:11:14: warning: unused variable 'srch' [-Wunused-variable]
   11 |  ll ans = 0, srch;
      |              ^~~~
#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...