제출 #153721

#제출 시각아이디문제언어결과실행 시간메모리
153721redaArranging Shoes (IOI19_shoes)C++14
45 / 100
32 ms3224 KiB
#include<bits/stdc++.h> using namespace std ; long long count_swaps (vector<int>s) { int n = s.size(); if(n<=16) { long long ans = 0 ; for(int i = 0 ;i < s.size();i+=2) { int j = i+1; while(s[i]!=-s[j]) { j++; } while (j!=i+1) { swap(s[j],s[j-1]); ans++; j--; } if(s[j]<0) { swap(s[i],s[j]); ans++; } } return ans; } else { long long x= n/2; return x*(x-1)/2; } }

컴파일 시 표준 에러 (stderr) 메시지

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:9:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i = 0 ;i < s.size();i+=2)
                      ~~^~~~~~~~~~
#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...