# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
782678 | NothingXD | 저울 (IOI15_scales) | C++17 | 1 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef complex<ld> point;
void debug_out(){cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
cerr << H << ' ';
debug_out(T...);
}
#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)
vector<int> a, b, c;
void init(int T) {
// khob alan chikar konam
}
void sort(vector<int> &v, int idx){
int x = getLightest(idx, idx+1, idx+2);
int y = getMedian(idx, idx+1, idx+2);
int z;
for (int i = idx; i < idx+3; i++){
if (i != x && i != y) z = i;
}
v.push_back(z);
v.push_back(y);
v.push_back(x);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void orderCoins() {
a.clear();
b.clear();
c.clear();
sort(a, 1);
sort(b, 4);
int RNG = rng() % 2;
if (RNG) swap(a, b);
while(!b.empty()){
if (a.size() == 3){
int tmp = getHeaviest(a[0], a[1], b.back());
if (tmp == b.back()){
while(!a.empty()){
c.push_back(a.back());
a.pop_back();
}
}
else{
tmp = getNextLightest(a[0], a[1], a[2], b.back());
while(a.back() != tmp){
c.push_back(a.back());
a.pop_back();
}
}
}
else if (a.size() == 2){
int tmp = getMedian(a[0], a[1], b.back());
if (tmp == b.back()){
c.push_back(a[1]);
a.pop_back();
}
else if (tmp == a[0]){
c.push_back(a[1]);
c.push_back(a[0]);
a.clear();
}
}
else if (a.size() == 1){
int idx = (a[0] <= 3? 1: 4);
if (a[0] == idx) idx++;
int tmp = getHeaviest(a[0], b.back(), idx);
if (tmp == b.back()){
c.push_back(a[0]);
a.clear();
}
}
c.push_back(b.back());
b.pop_back();
}
while(!a.empty()){
c.push_back(a.back());
a.pop_back();
}
int ans[6] = {0};
for (int i = 0; i < 6; i++){
ans[i] = c[i];
}
answer(ans);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |