제출 #428118

#제출 시각아이디문제언어결과실행 시간메모리
428118HazemArranging Shoes (IOI19_shoes)C++14
10 / 100
1080 ms1980 KiB
#include "shoes.h" #include <bits/stdc++.h> #define LL long long using namespace std; long long count_swaps(std::vector<int> s) { LL n = s.size()/2,ans = 0; int cnt = 0; for(int i=0;i<n*2;i++){ if(s[i]<0){ for(int j=i;j>cnt*2;j--) swap(s[j],s[j-1]),ans++; int idx = find(s.begin()+cnt*2,s.end(),-s[cnt*2])-s.begin(); assert(idx!=s.size()); for(int j = idx;j>cnt*2+1;j--) swap(s[j],s[j-1]),ans++; cnt++; } } return ans; }

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

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from shoes.cpp:2:
shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:18:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |    assert(idx!=s.size());
      |           ~~~^~~~~~~~~~
#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...