이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <limits>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
using namespace std;
using ll = long long;
int64_t count_swaps(vector<int> shoes){
ll length = shoes.size();
vector<bool> list_n(length, 0);
ll total = 0;
for(int i = 0; i < length; i++){
if(list_n[i] == 1){
continue;
}
ll curr_counter = 0;
ll curr_val = shoes[i];
if(curr_val > 0){
curr_counter++;
}
for(int j = i + 1; j < length; j++){
//cout << curr_counter << ", i = " << i << ", j = " << j << endl;
if(shoes[j] == -1 * curr_val && list_n[j] == 0){
list_n[j] = 1;
break;
}else{
if(list_n[j] == 0){
curr_counter++;
}
}
}
list_n[i] = 1;
//cout << "curr_counter = " << curr_counter << ", i = " << i << endl;
total += curr_counter;
/*for(int k = 0; k < length; k++){
cout << list_n[k] << " ";
}
cout << endl;
*/
}
return total;
}
# | 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... |