제출 #829356

#제출 시각아이디문제언어결과실행 시간메모리
829356JoksimKaktusArranging Shoes (IOI19_shoes)C++17
50 / 100
1077 ms3124 KiB
#include <bits/stdc++.h> #include <iostream> #include <vector> #include <cmath> #include <queue> #include <map> #include <algorithm> #include <iomanip> #include <set> using namespace std; long long count_swaps(vector <int> S){ long long res = 0; for(int i = 0;i < S.size();i++){ if(S[i] == 0){ continue; }else if(S[i] < 0){ int zero = 0; for(int j = i+1;j < S.size();j++){ if(S[j] == -S[i]){ res += j-(i+1) - zero; S[j] = 0; S[i] = 0; break; }else if(S[j] == 0){ zero++; } } }else{ int zero = 0; for(int j = i+1;j < S.size();j++){ if(-S[j] == S[i]){ res += j-(i) - zero; S[j] = 0; S[i] = 0; break; }else if(S[j] == 0){ zero++; } } } } return res; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:15:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i = 0;i < S.size();i++){
      |                   ~~^~~~~~~~~~
shoes.cpp:20:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |             for(int j = i+1;j < S.size();j++){
      |                             ~~^~~~~~~~~~
shoes.cpp:32:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             for(int j = i+1;j < S.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...