Submission #240853

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2408532020-06-21 10:04:23RayaBurong25_1Arranging Shoes (IOI19_shoes)C++17
10 / 100
1089 ms25296 KiB
#include "shoes.h"
#include <map>
#include <vector>
#include <algorithm>
#include <set>
int abs(int a)
{
return (a < 0)?-a:a;
}
long long count_swaps(std::vector<int> s) {
int i, sz, norp;
long long cnt = 0;
std::map<int, std::vector<int> > pos[2];
for (i = 0; i < s.size(); i++)
{
sz = abs(s[i]);
norp = (s[i] > 0);
if (pos[norp].find(sz) == pos[norp].end())
pos[norp][sz] = std::vector<int>();
pos[norp][sz].push_back(i);
}
int nxt;
std::vector<int> moved;
int ismoved[200005] = {0};
for (i = 0; i < s.size(); i++)
{
sz = abs(s[i]);
norp = (s[i] > 0);
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:16:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < s.size(); i++)
              ~~^~~~~~~~~~
shoes.cpp:27:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < s.size(); i++)
              ~~^~~~~~~~~~
shoes.cpp:35:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (nxt == pos[!norp][sz].size())
       ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#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...