Submission #1120924

#TimeUsernameProblemLanguageResultExecution timeMemory
1120924epicci23Scales (IOI15_scales)C++17
0 / 100
2 ms508 KiB
#include "bits/stdc++.h" #include "scales.h" //#define int long long #define all(v) v.begin() , v.end() #define sz(a) (int)a.size() using namespace std; void init(int T){ } void orderCoins(){ vector<int> v; array<int,3> a; set<int> s; for(int i = 1 ; i <= 3 ; i++) s.insert(i); a[0] = getLightest(1,2,3); s.erase(a[0]); a[2] = getHeaviest(1,2,3); s.erase(a[2]); a[1] = *s.begin(); s.erase(a[1]); vector<int> cur; cur.push_back(a[0]); cur.push_back(a[1]); cur.push_back(a[2]); // 4 ekle int u = getMedian(cur[0], 4, cur[2]); if(u == cur[0]) cur.insert(cur.begin(),4); else if(u == cur[2]) cur.push_back(4); else{ int u2 = getMedian(cur[0],4,cur[1]); if(u2 == 4) cur.insert(cur.begin()+1,4); else cur.insert(cur.begin()+2,4); } // 5 ekle u = getMedian(cur[0], 5, cur[3]); if(u == cur[0]) cur.insert(cur.begin(),5); else if(u == cur[3]) cur.push_back(5); else{ int u2 = getMedian(cur[1],5,cur[2]); if(u2 == cur[1]) cur.insert(cur.begin()+1,5); else if(u2 == 5) cur.insert(cur.begin()+2,5); else cur.insert(cur.begin()+3,5); } // 6 ekle u = getMedian(cur[0],6,cur[3]); if(u == cur[0]) cur.insert(cur.begin(),6); else if(u == cur[3]){ int u2 = getMedian(cur[3],6,cur[4]); if(u2 == cur[4]) cur.push_back(6); else cur.insert(cur.begin()+4,6); } else{ int u2 = getMedian(cur[1],6,cur[2]); if(u2 == 6) cur.insert(cur.begin()+2,6); else if(u2 == cur[1]) cur.insert(cur.begin()+1,6); else cur.insert(cur.begin()+3,6); } int W[6]; for(int i = 0 ; i <= 6 ; i++) W[i] = cur[i]; answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:8:15: warning: unused parameter 'T' [-Wunused-parameter]
    8 | void init(int T){
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:71:38: warning: iteration 6 invokes undefined behavior [-Waggressive-loop-optimizations]
   71 |   for(int i = 0 ; i <= 6 ; i++) W[i] = cur[i];
scales.cpp:71:21: note: within this loop
   71 |   for(int i = 0 ; i <= 6 ; i++) W[i] = cur[i];
      |                   ~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...