# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
143126 | 2019-08-13T06:39:37 Z | legend | Arranging Shoes (IOI19_shoes) | C++17 | 1000 ms | 16020 KB |
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(std::vector<int> s) { set<pair<int,int> > ms; map<int,int> pos; for(int i = 0;i<s.size();i++){ if(s[i]<0) ms.insert({i,s[i]}); pos[s[i]] = i; } int ps = 0; long long ans = 0; while(ps<s.size()){ pair<int,int> x; for(int i = ps;;i++){ if(s[i]<0){ x = {i,s[i]}; break; } } for(int i = ps;i<x.first;i++){ int u = s[i]; pos[u]++; } for(int i = x.first;i>ps;i--){ swap(s[i],s[i-1]); } for(int i = ps+1;;i++){ if(s[i] == -x.second){ ans+=(i-ps-1); for(int j = i;j>ps+1;j--) swap(s[j],s[j-1]); break; } } // cout<<ans<<endl; ps+=2; } return ans; return 1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 256 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 | 1065 ms | 16020 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |