제출 #423543

#제출 시각아이디문제언어결과실행 시간메모리
423543schseArranging Shoes (IOI19_shoes)C++17
50 / 100
1088 ms3112 KiB
#include "shoes.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
long long count_swaps(std::vector<int> s)
{
	long long numswaps = 0;
	for (int e, i = 0; i < s.size(); i += 2)
	{
		for (e = i + 1; e < s.size(); e++)
		{
			if (s[i] == -s[e])
				break;
		}

		while (e-- > i + 1)
		{
			numswaps++;
			swap(s[e], s[e + 1]);
		}
		if (s[i] > 0)
		{
			numswaps++;
			swap(s[i], s[i + 1]);
		}
	}

	return numswaps;
}

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:10:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for (int e, i = 0; i < s.size(); i += 2)
      |                     ~~^~~~~~~~~~
shoes.cpp:12:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   for (e = i + 1; e < s.size(); e++)
      |                   ~~^~~~~~~~~~
#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...