Submission #364655

#TimeUsernameProblemLanguageResultExecution timeMemory
364655BartolMScales (IOI15_scales)C++17
71.43 / 100
1 ms384 KiB
//#include "graderlib.c" #include "scales.h" #include <bits/stdc++.h> using namespace std; #define X first #define Y second #define mp make_pair #define pb push_back typedef long long ll; typedef pair <int, int> pii; typedef pair <int, pii> pip; typedef pair <pii, int> ppi; typedef pair <ll, ll> pll; const int INF=0x3f3f3f3f; int bio[10]; vector <int> sol; void ubaci(int x, int pos=INF) { bio[x]=1; pos=min(pos, (int)sol.size()); sol.insert(sol.begin()+pos, x); } int indeks(int x) { for (int i=0; i<(int)sol.size(); ++i) if (sol[i]==x) return i; return INF; } void ispis() { for (int x:sol) printf("%d ", x); printf("\n"); } void init(int T) { } void orderCoins() { sol.clear(); memset(bio, 0, sizeof bio); int p[6]={1, 2, 3, 4, 5, 6}, res[6]={0}; // random_shuffle(p, p+6); int A=p[0], C=p[2], x=p[3]; int B=getMedian(p[0], p[1], p[2]); ubaci(B, 0); if (B==p[0]) A=p[1]; else if (B==p[2]) C=p[1]; int br=getNextLightest(A, C, x, B); if (br==x) { ubaci(x); br=getLightest(A, B, C); if (br==C) swap(A, C); ubaci(A, 0); ubaci(C); } else { if (br==A) swap(A, C); ubaci(C); ubaci(A, 0); br=getMedian(A, B, x); if (br==A) ubaci(x, 0); else if (br==x) ubaci(x, 1); else ubaci(x); } // ispis(); //peta x=p[4]; br=getMedian(sol[1], sol[2], x); if (br==x) ubaci(x, 2); else if (br==sol[1]) { br=getMedian(sol[0], sol[1], x); if (br==sol[0]) ubaci(x, 0); else ubaci(x, 1); } else { br=getMedian(sol[2], sol[3], x); if (br==sol[3]) ubaci(x); else ubaci(x, 3); } // ispis(); //sesta x=p[5]; br=getMedian(sol[1], sol[2], x); if (br==x) ubaci(x, 2); else if (br==sol[2]) { br=getMedian(sol[3], sol[4], x); if (br==sol[3]) ubaci(x, 3); else if (br==x) ubaci(x, 4); else ubaci(x, 5); } else { br=getMedian(sol[0], sol[1], x); if (br==x) ubaci(x, 1); else ubaci(x, 0); } for (int i=0; i<6; ++i) res[i]=sol[i]; answer(res); return; }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:38:15: warning: unused parameter 'T' [-Wunused-parameter]
   38 | void init(int T) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...