# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
959441 | 2024-04-08T08:19:09 Z | NemanjaSo2005 | Arranging Shoes (IOI19_shoes) | C++17 | 1 ms | 348 KB |
#include "shoes.h" #include<bits/stdc++.h> #define ll long long using namespace std; const int maxn=2e5+5; int N,niz[maxn]; ll res=0; int prvalev(){ for(int i=1;i<=N;i++) if(niz[i]<0) return i; } int parod(int x){ for(int i=1;i<=N;i++) if(niz[i]==-x) return i; } void zamena(int y,int x){ for(int i=y;i>x;i--){ res++; swap(niz[i],niz[i-1]); } } ll count_swaps(vector<int> s) { N=s.size(); return (N/2-1)*(N/2); for(int i=0;i<N;i++) niz[i+1]=s[i]; for(int i=1;i<=N;i+=2){ int pl=prvalev(); zamena(pl,i); int pd=parod(niz[i]); // cout<<pl<<" "<<pd<<endl; zamena(pd,i+1); niz[i]=niz[i+1]=0; } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |