Submission #822756

#TimeUsernameProblemLanguageResultExecution timeMemory
822756vjudge1Arranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 9; int a[N] = {} , b[N] = {}; int count_swaps(vector<int>v){ int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn = 0 , mx = 0; i = 1; n = v.size(); map<int,deque<int>>mp; for(auto to : v){ if(mp[-to].size()){ a[i]++; b[i] = mp[-to].back(); a[b[i] - 1]--; }else { mp[to].push_back(i); } i++; } for(i = n; i >= 1; i--) a[i] += a[i + 1]; for(i = 1; i <= n; i++){ if(b[i]){ s += i - b[i]; if(v[i - 1] > 0) s--; if(i - 1 >= i) s -= a[i - 1] - a[i]; } } return s; }

Compilation message (stderr)

shoes.cpp:13:5: error: ambiguating new declaration of 'int count_swaps(std::vector<int>)'
   13 | int count_swaps(vector<int>v){
      |     ^~~~~~~~~~~
In file included from shoes.cpp:1:
shoes.h:7:11: note: old declaration 'long long int count_swaps(std::vector<int>)'
    7 | long long count_swaps(std::vector<int> S);
      |           ^~~~~~~~~~~
shoes.cpp: In function 'int count_swaps(std::vector<int>)':
shoes.cpp:14:9: warning: unused variable 'q' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |         ^
shoes.cpp:14:17: warning: unused variable 'j' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                 ^
shoes.cpp:14:21: warning: unused variable 'm' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                     ^
shoes.cpp:14:27: warning: unused variable 'z' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                           ^
shoes.cpp:14:38: warning: unused variable 'f' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                                      ^
shoes.cpp:14:42: warning: unused variable 'l' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                                          ^
shoes.cpp:14:46: warning: unused variable 'r' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                                              ^
shoes.cpp:14:50: warning: unused variable 'k' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                                                  ^
shoes.cpp:14:54: warning: unused variable 'x' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                                                      ^
shoes.cpp:14:58: warning: unused variable 'y' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                                                          ^
shoes.cpp:14:62: warning: unused variable 'mn' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                                                              ^~
shoes.cpp:14:72: warning: unused variable 'mx' [-Wunused-variable]
   14 |     int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 0 , mx = 0;
      |                                                                        ^~