Submission #261433

#TimeUsernameProblemLanguageResultExecution timeMemory
261433ElyesChaabouniScales (IOI15_scales)C++14
45.45 / 100
1 ms384 KiB
/*#pragma GCC optimize("O3")*/ #include<bits/stdc++.h> #include"scales.h" //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> #define eps 1e-9 #define MOD1 998244353 #define MOD2 1000000007 #define INV_10 299473306 #define INF 1000000001 #define PI 3.14159265358979323846 using namespace std; void init(int T) { return; } void orderCoins() { int ans[6]; set<int>s; s.insert(1); s.insert(2); s.insert(3); int a[3]; 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.clear(); s.insert(4); s.insert(5); s.insert(6); int b[3]; b[0]=getLightest(4, 5, 6); s.erase(b[0]); b[2]=getHeaviest(4, 5, 6); s.erase(b[2]); b[1]=(*s.begin()); s.clear(); vector<int>v; for(int i = 0; i < 3; i++) v.push_back(b[i]); int x=getNextLightest(a[0], a[1], a[2], b[2]); if(x==a[0]) { int y = getMedian(a[0], b[1], b[2]); if(y==b[2]) { for(int i = 0; i < 3; i++) ans[i]=b[i]; for(int i = 0; i < 3; i++) ans[3+i]=a[i]; answer(ans); return; } else if(y==a[0]) v.insert(v.begin()+2, a[0]); else { int d=getMedian(a[0], b[0], b[1]); if(d==a[0]) v.insert(v.begin()+1, a[0]); else v.insert(v.begin(), a[0]); } for(int i = 1; i < 3; i++) { int d=getNextLightest(b[0], b[1], b[2], a[i]); for(int j = 0; j < v.size(); j++) { if(v[j]==d) { v.insert(v.begin()+j, a[i]); break; } } } } else { int pos=2; if(x==a[1]) { pos=1; v.push_back(a[1]); } v.push_back(a[2]); for(int i = 0; i < pos; i++) { int d=getNextLightest(b[0], b[1], b[2], a[i]); for(int j = 0; j < v.size(); j++) { if(v[j]==d) { v.insert(v.begin()+j, a[i]); break; } } } } for(int i = 0; i < 6; i++) ans[i]=v[i]; answer(ans); } //size

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:14:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:70:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int j = 0; j < v.size(); j++)
                      ~~^~~~~~~~~~
scales.cpp:92:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int j = 0; j < v.size(); j++)
                      ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...