제출 #1061885

#제출 시각아이디문제언어결과실행 시간메모리
1061885PetrixArranging Shoes (IOI19_shoes)C++17
0 / 100
1 ms348 KiB
#include <iostream> #include <vector> #include <map> #include <deque> #include "shoes.h" using namespace std; long long count_swaps(vector<int> s){ int n=s.size(); map<int,deque<int>> np; vector<int> a; long long i,j,aux,rasp=0; for(i=0;i<n;i++){ if(np[-s[i]].empty()){ np[s[i]].push_back(j); for (j=i+1;j<=n;j+=(i+1)&(-(i+1))) a[j]++; }else{ aux=np[-s[i]].front();np[-s[i]].pop_front(); rasp+=i; for(j=aux;j;j-=aux&(-aux)) rasp-=a[j]; if(s[i]<0) rasp++; for(j=aux;j<=n;j+=aux&(-aux)) a[j]++; } } return rasp; }

컴파일 시 표준 에러 (stderr) 메시지

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:15:31: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
   15 |             np[s[i]].push_back(j);
      |             ~~~~~~~~~~~~~~~~~~^~~
#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...