# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143296 | 2019-08-13T14:34:48 Z | mat_v | Arranging Shoes (IOI19_shoes) | C++14 | 14 ms | 9848 KB |
#include "shoes.h" #include <bits/stdc++.h> #include <cstdio> #include <cassert> #define pb push_back using namespace std; int n; vector<int> tike[200005][2]; int dokle[200005][2]; long long count_swaps(std::vector<int> s) { n = s.size()/2; for(int i=0; i<2*n; i++){ if(s[i] < 0)tike[abs(s[i])][0].pb(i); else tike[s[i]][1].pb(i); } int l = 0; long long res = 0; while(l < 2*n){ int koji = abs(s[l]); int pom = l+1; while(pom < 2*n){ if(pom == -s[l])break; pom++; } while(pom > l+1){ swap(s[pom], s[pom - 1]); pom--; res++; } l += 2; } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9720 KB | Output is correct |
2 | Correct | 10 ms | 9720 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9720 KB | Output is correct |
2 | Correct | 10 ms | 9720 KB | Output is correct |
3 | Incorrect | 12 ms | 9848 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9720 KB | Output is correct |
2 | Correct | 10 ms | 9720 KB | Output is correct |
3 | Incorrect | 11 ms | 9720 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 9720 KB | Output is correct |
2 | Correct | 14 ms | 9720 KB | Output is correct |
3 | Incorrect | 12 ms | 9848 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9720 KB | Output is correct |
2 | Correct | 10 ms | 9720 KB | Output is correct |
3 | Incorrect | 12 ms | 9848 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9720 KB | Output is correct |
2 | Correct | 10 ms | 9720 KB | Output is correct |
3 | Incorrect | 12 ms | 9848 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |