제출 #339366

#제출 시각아이디문제언어결과실행 시간메모리
339366KerimArranging Shoes (IOI19_shoes)C++17
10 / 100
1 ms364 KiB
#include "bits/stdc++.h" #include "shoes.h" #define MAXN 100009 #define INF 1000000007 #define mp(x,y) make_pair(x,y) #define all(v) v.begin(),v.end() #define pb(x) push_back(x) #define wr cout<<"----------------"<<endl; #define ppb() pop_back() #define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++) #define ff first #define ss second #define my_little_dodge 46 #define debug(x) cerr<< #x <<" = "<< x<<endl; using namespace std; typedef long long ll; typedef pair<int,int> PII; template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} using namespace std; int vis[MAXN]; long long count_swaps(std::vector<int> s) { int n=s.size(),ans=0; for(int i=0;i<n;i++){ if(vis[i])continue;vis[i]=-1; for(int j=i+1;j<n;j++) if(!vis[j] and s[i]==-s[j]){ ans+=(s[i]>s[j]); ans+=j-i; for(int k=i;k<=j;k++)ans+=vis[k]; vis[j]=1; //cout<<s[i]<<" "<<s[j]<<" "<<ans<<endl; break; } } return ans; } /* int main() { freopen("file.in","r",stdin); int n; assert(1 == scanf("%d", &n)); vector<int> S(2 * n); for (int i = 0; i < 2 * n; i++) assert(1 == scanf("%d", &S[i])); long long result = count_swaps(S); printf("%lld\n", result); return 0; }*/

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

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:26:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   26 |   if(vis[i])continue;vis[i]=-1;
      |   ^~
shoes.cpp:26:22: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   26 |   if(vis[i])continue;vis[i]=-1;
      |                      ^~~
#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...