Submission #253491

#TimeUsernameProblemLanguageResultExecution timeMemory
253491BadrangiikhArranging Shoes (IOI19_shoes)C++14
0 / 100
0 ms256 KiB
#include<bits/stdc++.h> #include <deque> #include <cmath> using namespace std; #define ll long long /*freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);*/ long long count_swaps ( vector < int > s ) { long long n = s . size ( ) ; long long x = 0 ; long long y = 0 ; while ( s . size ( ) > 0 ) { for ( int i = 0 ; i < s . size ( ) ; i ++ ) { if ( s [ i ] < 0 ) { y = abs ( s [ i ] ) ; for ( int j = 0 ; j < s . size ( ) ; j ++ ) { if ( s [ j ] == y ) { if ( j > i ) { x += ( i + j - 1 ) ; s . erase ( s . begin ( ) + j ) ; s . erase ( s . begin ( ) + i ) ; } else { x += ( i + j ) ; s . erase ( s . begin ( ) + i ) ; s . erase ( s . begin ( ) + j ) ; } break ; } } break ; } } } }

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:16:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for ( int i = 0 ; i < s . size ( ) ; i ++ ) {
                           ~~^~~~~~~~~~~~~~
shoes.cpp:19:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for ( int j = 0 ; j < s . size ( ) ; j ++ ) {
                                   ~~^~~~~~~~~~~~~~
shoes.cpp:12:15: warning: unused variable 'n' [-Wunused-variable]
     long long n = s . size ( ) ;
               ^
shoes.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }    
 ^
#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...