제출 #143899

#제출 시각아이디문제언어결과실행 시간메모리
143899tincamateiArranging Shoes (IOI19_shoes)C++14
10 / 100
2 ms380 KiB
#include "shoes.h" #include <vector> #include <cstdlib> using namespace std; long long count_swaps(std::vector<int> s) { int N = s.size() / 2; vector<vector<int> > pozLeft(N), pozRight(N); for(int i = 0; i < 2 * N; ++i) if(s[i] < 0) pozLeft[-s[i] - 1].push_back(i); else pozRight[s[i] - 1].push_back(i); long long rez = 0LL; for(int i = 0; i < N; ++i) { for(int j = 0; j < pozLeft[i].size(); ++j) { rez = rez + abs(pozLeft[i][j] - pozRight[i][j]) - 1; if(pozLeft[i][j] > pozRight[i][j]) ++rez; } } return rez; }

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

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