# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
421125 | daanolav | Arranging Shoes (IOI19_shoes) | C++14 | 1 ms | 280 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shoes.h"
#include <vector>
#include <bitset>
#include <tuple>
#include <cmath>
using namespace std;
typedef vector<int> vi;
typedef pair<vi,vi> vivi;
int n,num,shoeSize,index;
long long count_swaps(std::vector<int> s) {
n = s.size() / 2;
vivi sizes[n + 1];
for(index = 0; index < 2 * n; ++index) {
num = s[index];
//cerr << "shoe num " << index << " is " << num << endl;
shoeSize = abs(num);
if(num < 0) {
sizes[shoeSize].first.push_back(index);
} else {
sizes[shoeSize].second.push_back(index);
}
}
long long swapsNeeded = 0;
for(vivi shoes : sizes) {
//cerr << "lop" << endl;
//cerr << shoes.first.size() << endl;
for(index = 0; index < shoes.first.size(); ++index) {
//cerr << "comparing " << shoes.first[index] << " and " << shoes.second[index] << endl;
if(shoes.second[index] > shoes.first[index]) {
swapsNeeded += shoes.second[index] - shoes.first[index] - 1;
} else {
swapsNeeded += shoes.first[index] - shoes.second[index];
}
}
}
return swapsNeeded;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |