Submission #289887

#TimeUsernameProblemLanguageResultExecution timeMemory
289887evpipisArranging Shoes (IOI19_shoes)C++14
10 / 100
1 ms384 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int len = 2e5+5; int vis[len]; ll count_swaps(vector<int> shoe) { ll ans = 0; for (int i = 0; i < shoe.size(); i++){ if (vis[i]) continue; int j = i+1, cnt = 0; while (shoe[j] != -shoe[i]) cnt += (!vis[j]), j++; ans += cnt + (shoe[i] > 0); vis[i] = vis[j] = 1; } return ans; }

Compilation message (stderr)

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