# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
820131 |
2023-08-10T20:02:42 Z |
tolbi |
Scales (IOI15_scales) |
C++17 |
|
1 ms |
260 KB |
#pragma optimize("Bismillahirrahmanirrahim");
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
//Sani buyuk Osman Pasa Plevneden cikmam diyor
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename T> istream& operator>>(istream& is, vector<T> &v){for (auto &it : v) is>>it;return is;}
template<typename T, size_t Y> istream& operator>>(istream& is, array<T,Y> &v){for (auto &it : v) is>>it;return is;}
template<typename T> ostream& operator<<(ostream& os, vector<T> &v){for (auto &it : v) os<<it<<" ";return os;}
template<typename T, size_t Y> ostream& operator<<(ostream& os, array<T,Y> &v){for (auto &it : v) os<<it<<" ";return os;}
template<typename X, typename Y> istream& operator>>(istream& is, pair<X,Y> &pr){return is<<pr.first<<" "<<pr.second;}
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> &pr){return os>>pr.first>>pr.second;}
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define vint(x) vector<int> x
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define rev(x) reverse(x.begin(), x.end())
#define endl '\n'
#define tol(bi) (1LL<<((int)(bi)))
typedef long long ll;
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include "scales.h"
void init(int T) {
/* ahmet23 orz... */
}
int getMedian(int A, int B, int C);
int getHeaviest(int A, int B, int C);
int getLightest(int A, int B, int C);
int getNextLightest(int A, int B, int C, int D);
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
int ans = getLightest(W[0],W[1],W[2]);
swap(W[ans-1],W[0]);
ans=getMedian(W[0],W[1],W[3]);
if (ans==W[3]){
swap(W[3],W[1]);
}
else if (ans==W[0]){
swap(W[3],W[1]);
swap(W[0],W[1]);
}
ans=getNextLightest(W[0],W[2],W[3],W[1]);
if (ans==W[3]){
swap(W[2],W[3]);
}
ans=getLightest(W[3],W[4],W[5]);
if (ans==W[3]){
ans=getHeaviest(W[3],W[4],W[5]);
if (ans==W[4])swap(W[4], W[5]);
//5 moves
answer(W);return /*W*/;
}
//ahb
if (ans==W[5]) swap(W[4],W[5]);
ans=getMedian(W[2],W[3],W[5]);
if (ans==W[2]){
swap(W[2],W[4]);
swap(W[3],W[5]);
ans=getMedian(W[0],W[1],W[2]);
if (ans==W[2]){
swap(W[1],W[2]);
ans=getHeaviest(W[0],W[2],W[3]);
if (ans==W[2]){
swap(W[2],W[3]);
//7 moves
answer(W);return /*W*/;
}
}
else if (ans==W[0]){
swap(W[1],W[2]);
swap(W[0],W[1]);
ans=getMedian(W[1],W[2],W[3]);
if (ans==W[1]){
swap(W[2],W[3]);
swap(W[1],W[2]);
}
if (ans==W[3]){
swap(W[2],W[3]);
}
//7 moves
answer(W);return /*W*/;
}
else {
//6 moves
answer(W);return /*W*/;
}
}
else if (ans==W[5]){
/*
swap(W[3],W[4]);
swap(W[4],W[5]);
swap(W[3],W[4]);
without loss of generality
*/
swap(W[3],W[5]);
}
//[0,3] sorted. insert 4 between them.
//0 1 2 3 4
ans=getMedian(W[2],W[3],W[4]);
if (ans==W[3]){
//6 moves
answer(W);return /*W*/;
}
else if (ans==W[4]){
swap(W[3],W[4]);
//6 moves
answer(W);return /*W*/;
}
//0 1 4
swap(W[3],W[4]);
swap(W[2],W[3]);
ans=getMedian(W[0],W[1],W[2]);
if (ans==W[0]){
swap(W[1],W[2]);
swap(W[0],W[1]);
}
else if (ans==W[2]){
swap(W[1],W[2]);
}
//6 moves
answer(W);return /*W*/;
}
Compilation message
scales.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
1 | #pragma optimize("Bismillahirrahmanirrahim");
|
scales.cpp: In function 'void init(int)':
scales.cpp:35:15: warning: unused parameter 'T' [-Wunused-parameter]
35 | void init(int T) {
| ~~~~^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
260 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
17 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
18 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
19 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
21 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
22 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
23 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
24 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
25 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
26 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
27 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
28 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
29 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
30 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
32 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
33 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
34 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
35 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
36 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
37 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
38 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
39 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
40 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |