# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143086 | 2019-08-13T01:09:20 Z | daniel920712 | Arranging Shoes (IOI19_shoes) | C++14 | 1000 ms | 1916 KB |
#include <iostream> #include <stdio.h> #include <vector> using namespace std; long long count_swaps(std::vector<int> S) { long long ans=0,N=S.size(),i,j,k; int t; for(i=0;i<N/2;i++) { for(j=2*i;j<N;j++) { if(S[j]<0) { ans+=(j-2*i); t=0-S[j]; for(k=j;k>2*i;k--) swap(S[k],S[k-1]); break; } } for(j=2*i+1;j<N;j++) { if(S[j]==t) { ans+=(j-2*i-1); t=0-S[j]; for(k=j;k>2*i+1;k--) swap(S[k],S[k-1]); break; } } /*for(j=0;j<N;j++) printf("%d ",S[j]); printf("\n");*/ } ans=(N/2)*(N/2-1)/2; return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Execution timed out | 1061 ms | 1916 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |