Submission #283138

# Submission time Handle Problem Language Result Execution time Memory
283138 2020-08-25T10:29:07 Z IWANTTOGETGOLDINIOI Arranging Shoes (IOI19_shoes) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <iomanip>
#include <cmath>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>

using namespace std;

#define FOR(i,n) for(int me=0;me<n;me++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define ll long long 
//#define int long long
#define ld long double
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define iii pair<ii,int>
#define il pair<ll,ll>
#define vv vector
#define endl '\n'
 
int count_swaps( vector < int > vc ){
	for (int i = 0;i < vc.size();i++){
		if (vc[i] < 0){
			for (int j = i;j < vc.size();j++){
				if (vc[j] == -vc[i]){
					ans += (j - i);
				}
			}
		} else {
			for (int j = i;j < vc.size();j++){
				if(-vc[i] == vc[j]){
					ans += (j-i);
				}
			}
		}
	}
	return ans;
}

Compilation message

shoes.cpp: In function 'int count_swaps(std::vector<int>)':
shoes.cpp:32:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |  for (int i = 0;i < vc.size();i++){
      |                 ~~^~~~~~~~~~~
shoes.cpp:34:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |    for (int j = i;j < vc.size();j++){
      |                   ~~^~~~~~~~~~~
shoes.cpp:36:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   36 |      ans += (j - i);
      |      ^~~
      |      abs
shoes.cpp:40:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |    for (int j = i;j < vc.size();j++){
      |                   ~~^~~~~~~~~~~
shoes.cpp:42:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   42 |      ans += (j-i);
      |      ^~~
      |      abs
shoes.cpp:47:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   47 |  return ans;
      |         ^~~
      |         abs