제출 #305936

#제출 시각아이디문제언어결과실행 시간메모리
305936kylych03Arranging Shoes (IOI19_shoes)C++14
10 / 100
1 ms384 KiB
#include "shoes.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; long long res[200010]; int vis[200011]; long long count_swaps(std::vector<int> s) { long long sum = 0; for(int i = 0 ; i < s.size(); i++){ if(vis[i]==1) continue; int j = i+1; while( s[i] != ((-1)*s[j] ) ){ res[j]++; j++; } sum += (j - i - 1 + (res[j] - res[i])); if(s[i] > 0) sum++; vis[j]=1; } return sum; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:12:23: 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 < s.size(); i++){
      |                     ~~^~~~~~~~~~
#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...