# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
197397 | 2020-01-20T19:24:47 Z | Ahmed_Selim | Arranging Shoes (IOI19_shoes) | C++14 | 23 ms | 19552 KB |
#include <iostream> #include <cstring> #include <vector> #include <set> #include <algorithm> #define MOD 1000000007 using namespace std; long long int cvp, n; vector<int> konum[2][200010]; long long int count_swaps(vector<int> S){ for (n = 0; S[n] ; ++n){ if(S[n]<0)konum[1][-S[n]].push_back(n); else konum[0][S[n]].push_back(n); } for (int i = 0; i < n; i+=2){ if(S[i]<0){ int j=0; while(konum[0][S[i]][j]<0)j++; int index=konum[0][S[i]][j]; while(index!=i+1){ swap(S[index], S[index-1]); cvp++; } konum[0][S[i]][j]=-1; }else{ int j=0; while(konum[0][S[i]][j]<0)j++; int index=konum[0][S[i]][j]; while(index!=i+1){ swap(S[index], S[index-1]); cvp++; } konum[0][S[i]][j]=-1; cvp++; } } return cvp; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 23 ms | 19448 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 23 ms | 19448 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 23 ms | 19448 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 23 ms | 19552 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 23 ms | 19448 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 23 ms | 19448 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |