제출 #1088215

#제출 시각아이디문제언어결과실행 시간메모리
1088215browntoad저울 (IOI15_scales)C++14
55.56 / 100
1 ms600 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; #define ll long long // #define int ll #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, n+1) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) #define pii pair<int, int> #define f first #define s second #define pb push_back #define ALL(x) (x).begin(), (x).end() #define SZ(x) (int)((x).size()) const ll maxn = 1e5+5; int tt; void init(int T){ tt = T; } void orderCoins(){ vector<int> ww = {1, 2, 3, 4, 5, 6}; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); shuffle(ALL(ww), rng); int mnl = getLightest(ww[0], ww[1], ww[2]), mxl = getHeaviest(ww[0], ww[1], ww[2]); int mel; REP(i, 3) if (ww[i] != mnl && ww[i] != mxl) mel = ww[i]; int mnr = getLightest(ww[3], ww[4], ww[5]), mxr = getHeaviest(ww[3], ww[4], ww[5]), mer; FOR(i, 3, 6) if (ww[i] != mnr && ww[i] != mxr) mer= ww[i]; int t1 = getMedian(mnl, mxl, mnr); if (t1 == mxl){ int fans[6] = {mnl, mel, mxl, mnr, mer, mxr}; answer(fans); return; } int t2, t3, t4; if (t1 == mnr){ t2 = getNextLightest(mnl, mnr, mxl, mxr); if (t2 == mnl){ t3 = getNextLightest(mel, mxl, mer, mnr); if (t3 == mel){ t4 = getMedian(mxl, mer, mxr); if (t4 == mer){ int fans[6] = {mnl, mnr, mel, mxl, mer, mxr}; answer(fans); } else{ int fans[6] = {mnl, mnr, mel, mer, mxl, mxr}; answer(fans); } } else if (t3 == mxl){ int fans[6] = {mnl, mel, mnr, mxl, mer, mxr}; answer(fans); } else { t4 = getMedian(mnl, mel, mnr); if (t4 == mel){ int fans[6] = {mnl, mel, mnr, mer, mxl, mxr}; answer(fans); } else{ int fans[6] = {mnl, mnr, mer, mel, mxl, mxr}; answer(fans); } } } else{ t3 = getMedian(mnr, mel, mxr); if (t3 == mnr){ int fans[6] = {mnl, mel, mnr, mer, mxr, mxl}; answer(fans); } else if (t3 == mel){ t4 = getMedian(mnr, mel, mer); if (t4 == mel){ int fans[6] = {mnl, mnr, mel, mer, mxr, mxl}; answer(fans); } else { int fans[6] = {mnl, mnr, mer, mel, mxr, mxl}; answer(fans); } } else{ int fans[6] = {mnl, mnr, mer, mxr, mel, mxl}; answer(fans); } } } else { t2 = getNextLightest(mnl, mnr, mxl, mxr); if (t2 == mnl){ int fans[6] = {mnr, mer, mxr, mnl, mel, mxl}; answer(fans); } else if (t2 == mxl){ t3 = getNextLightest(mel, mxr, mer, mnl); if (t3 == mer){ t4 = getMedian(mxr, mel, mxl); if (t4 == mel){ int fans[6] = {mnr, mnl, mer, mxr, mel, mxl}; answer(fans); } else{ int fans[6] = {mnr, mnl, mer, mel, mxr, mxl}; answer(fans); } } else if (t3 == mxr){ int fans[6] = {mnr, mer, mnl, mxr, mel, mxl}; answer(fans); } else { t4 = getMedian(mnr, mer, mnl); if (t4 == mer){ int fans[6] = {mnr, mer, mnl, mel, mxr, mxl}; answer(fans); } else{ int fans[6] = {mnr, mnl, mel, mer, mxr, mxl}; answer(fans); } } } else{ t3 = getMedian(mnl, mer, mxl); if (t3 == mnl){ int fans[6] = {mnr, mer, mnl, mel, mxl, mxr}; answer(fans); } else if (t3 == mer){ t4 = getMedian(mnl, mer, mel); if (t4 == mer){ int fans[6] = {mnr, mnl, mer, mel, mxl, mxr}; answer(fans); } else { int fans[6] = {mnr, mnl, mel, mer, mxl, mxr}; answer(fans); } } else{ int fans[6] = {mnr, mnl, mel, mxl, mer, mxr}; answer(fans); } } } }

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

scales.cpp: In function 'void orderCoins()':
scales.cpp:37:52: warning: 'mer' may be used uninitialized in this function [-Wmaybe-uninitialized]
   37 |         int fans[6] = {mnl, mel, mxl, mnr, mer, mxr};
      |                                                    ^
scales.cpp:37:52: warning: 'mel' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...