제출 #143841

#제출 시각아이디문제언어결과실행 시간메모리
143841Bodo171Arranging Shoes (IOI19_shoes)C++14
10 / 100
1083 ms16376 KiB
#include "shoes.h" #include <vector> #include <iostream> using namespace std; const int nmax=100005; vector<int> v[nmax]; int fin[nmax],po[nmax]; int nr,i,j; long long count_swaps(vector<int> s) { int n=s.size(); for(int i=0;i<n;i++) { if(s[i]<0) { v[-s[i]].push_back(nr); fin[i]=2*nr; nr++; } } for(i=0;i<n;i++) { if(s[i]>0) { fin[i]=(2*v[s[i]][po[s[i]]]+1); po[s[i]]++; } } int ans=0; for(i=0;i<n;i++) for(j=i+1;j<n;j++) ans+=(fin[i]>fin[j]); return ans; }

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:29:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for(i=0;i<n;i++)
     ^~~
shoes.cpp:32:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  return ans;
  ^~~~~~
#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...