제출 #314546

#제출 시각아이디문제언어결과실행 시간메모리
314546baibhav26062008Arranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
long long count_swaps(std::vector<int> s) {
	int n = s.size()/2;
	if (n == 1) {
		if (s[0] < s[1]) {
			return 0;
		} else {
			return 1;
		}
	} 
	for (int i = 0; i < n; i++) {
		ans++;
	}
	return ans;
}

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:14:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |   ans++;
      |   ^~~
      |   abs
shoes.cpp:16:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |  return ans;
      |         ^~~
      |         abs