제출 #310964

#제출 시각아이디문제언어결과실행 시간메모리
310964saarang123Arranging Shoes (IOI19_shoes)C++14
10 / 100
1055 ms3200 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define all(x) x.begin(), x.end() #define pb push_back #define mp make_pair template<class T> bool remin(T& a, const T& b) { return a > b ? a = b, 1 : 0; } template<class T> bool remax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count()); ll count_swaps(vector<int> a) { std::ios::sync_with_stdio(0); std::cout.tie(0); std::cin.tie(0); ll i, j, n, m; n = a.size() / 2; //cin >> n; //vector<int> a(2 * n); //for(auto &x : a) cin >> x; ll ans = 0; for(i = 0; i < 2 * n; i += 2) { int id = -1; for(j = i; j < 2 * n; j++) { if(a[j] < 0) { id = j; break; } } for(j = id; j > i; j--) { swap(a[j], a[j - 1]); //cout << j << " " << j - 1 << endl; ans++; } for(j = i + 1; j < 2 * n; j++) { if(a[j] == - a[i]) { id = j; break; } } for(j = id; j > i + 1; j--) { swap(a[j], a[j - 1]); //cout << j << " " << j - 1 << endl; ans++; } //for(auto &x : a) cout << x << " "; cout << endl; } //cout << ans << "\n"; return ans; }

컴파일 시 표준 에러 (stderr) 메시지

shoes.cpp: In function 'll count_swaps(std::vector<int>)':
shoes.cpp:20:17: warning: unused variable 'm' [-Wunused-variable]
   20 |     ll i, j, n, m;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...