제출 #652549

#제출 시각아이디문제언어결과실행 시간메모리
652549jiahng저울 (IOI15_scales)C++14
38.46 / 100
1 ms336 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef vector <int> vi; typedef vector <pi> vpi; typedef pair<pi, ll> pii; typedef set <ll> si; typedef long double ld; #define f first #define s second #define mp make_pair #define FOR(i,s,e) for(int i=s;i<=int(e);++i) #define DEC(i,s,e) for(int i=s;i>=int(e);--i) #define pb push_back #define all(x) (x).begin(), (x).end() #define lbd(x, y) lower_bound(all(x), y) #define ubd(x, y) upper_bound(all(x), y) #define aFOR(i,x) for (auto i: x) #define mem(x,i) memset(x,i,sizeof x) #define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define maxn 200010 #define INF (ll)1e9 #define MOD 1000000007 typedef pair <vi, int> pvi; typedef pair <int,pi> ipi; typedef vector <pii> vpii; vi ans; int lans[6]; void solve(vi v){ if (v.size() == 3){ int a = getLightest(v[0],v[1],v[2]); int b = getMedian(v[0],v[1],v[2]); int c = getHeaviest(v[0],v[1],v[2]); ans.pb(a); ans.pb(b); ans.pb(c); return; } int mn = v[0]; for (int i = 1; i < v.size(); i += 2){ if (i + 1 == (int)v.size()){ int x; aFOR(j, v) if (j != mn && j != v[i]) x = j; mn = getLightest(mn, v[i], x); }else mn = getLightest(mn, v[i], v[i+1]); } ans.pb(mn); v.erase(find(all(v), mn)); solve(v); } void init(int T) { } void orderCoins() { ans.clear(); solve({1,2,3,4,5,6}); //aFOR(i, ans) cout << i << ' '; cout << '\n'; FOR(i,0,5) lans[i] = ans[i]; answer(lans); }

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

scales.cpp: In function 'void solve(vi)':
scales.cpp:45:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     for (int i = 1; i < v.size(); i += 2){
      |                     ~~^~~~~~~~~~
scales.cpp: In function 'void init(int)':
scales.cpp:56:15: warning: unused parameter 'T' [-Wunused-parameter]
   56 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void solve(vi)':
scales.cpp:49:29: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   49 |             mn = getLightest(mn, v[i], x);
      |                  ~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...