제출 #282344

#제출 시각아이디문제언어결과실행 시간메모리
282344catalystgmaArranging Shoes (IOI19_shoes)C++14
25 / 100
40 ms8672 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int,int> #define pll pair<ll,ll> #define pli pair<ll,int> #define pil pair<int,ll> #define fi first #define se second #define inf (INT_MAX/2-1) #define infl (1LL<<60) #define vi vector<int> #define vl vector<ll> #define pb push_back #define sz(a) (int)(a).size() #define all(a) begin(a),end(a) #define y0 y5656 #define y1 y7878 #define y2 y9090 #define aaa system("pause"); #define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa #define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa #define dbgs(x) cerr<<(#x)<<"[stl]: ";for(auto _:x)cerr<<_<<' ';cerr<<'\n',aaa #define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa #include "shoes.h" using namespace std; ll f_la_fel (vi v) { int n = sz(v); auto to_equal = [&n] (vi v, vi to) { vi p1, p2; int i, j, z; for (i = 0; i < n; i++) if (v[i] < 0) p1.pb(i); for (i = 0; i < n; i++) if (to[i] < 0) p2.pb(i); ll ans = 0; for (i = 0; i < n/2; i++) ans += abs(p2[i]-p1[i]); return ans; }; int x = abs(v[0]); vi to1(n, x), to2(n, -x); for (int i = 0; i < n; i += 2) { to1[i] *= -1; to2[i] *= -1; } return min(to_equal(v, to1), to_equal(v, to2)); } ll count_swaps (vi v) { int n = sz(v); if (n == 2) { if (v[0] > v[1]) return 1; return 0; } return f_la_fel(v); } //int main () { // int n; cin >> n; // int i, j, z; // vi v(n*2); // for (i = 0; i < 2*n; i++) cin >> v[i]; // cout << count_swaps(v); // return 0; //}

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

shoes.cpp: In lambda function:
shoes.cpp:32:12: warning: unused variable 'j' [-Wunused-variable]
   32 |     int i, j, z;
      |            ^
shoes.cpp:32:15: warning: unused variable 'z' [-Wunused-variable]
   32 |     int i, j, z;
      |               ^
#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...