Submission #465874

#TimeUsernameProblemLanguageResultExecution timeMemory
465874dattranxxxArranging Shoes (IOI19_shoes)C++14
10 / 100
1 ms292 KiB
/* * Author : shora */ #include "shoes.h" #include <bits/stdc++.h> #define print(_v) for (auto &_ : _v) {cerr << _ << ' ';} cerr << endl; using namespace std; using ll = long long; const int oo = 1e9; ll n; namespace task_5 { ll solve(vector<int>& a) { ll res = 0; for (int i = 0; i < a.size(); i += 2) { int j = find(a.begin() + i + 1, a.end(), -a[i]) - a.begin(); if (a[i] < 0) res += j - i - 1; else res += j - i; } return res; } } long long count_swaps(std::vector<int> a) { n = a.size() / 2; return task_5::solve(a); return -1; }

Compilation message (stderr)

shoes.cpp: In function 'll task_5::solve(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 < a.size(); i += 2) {
      |                   ~~^~~~~~~~~~
#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...