답안 #707201

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
707201 2023-03-08T15:14:39 Z baojiaopisu 저울 (IOI15_scales) C++14
0 / 100
1 ms 472 KB
#include<bits/stdc++.h>
#include "scales.h"

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;

#define fi first
#define se second
#define left BAO
#define right ANH
#define pb push_back
#define pf push_front
#define mp make_pair
#define ins insert
#define btpc __builtin_popcount
#define btclz __builtin_clz

#define sz(x) (int)(x.size());
#define all(x) x.begin(), x.end()
#define debug(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int d4x[4] = {1, 0, -1, 0}; int d4y[4] = {0, 1, 0, -1};
int d8x[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int d8y[8] = {1, 1, 0, -1, -1, -1, 0, 1};

template<class X, class Y>
    bool minimize(X &x, const Y &y) {
        if (x > y)
        {
            x = y;
            return true;
        }
        return false;
    }
template<class X, class Y>
    bool maximize(X &x, const Y &y) {
        if (x < y)
        {
            x = y;
            return true;
        }
        return false;
    }

const int MOD = 1e9 + 7; //998244353

template<class X, class Y>
	void add(X &x, const Y &y) {
		x = (x + y);
		if(x >= MOD) x -= MOD;
	}

template<class X, class Y> 
	void sub(X &x, const Y &y) {
		x = (x - y);
		if(x < 0) x += MOD;
	}

/* Author : Le Ngoc Bao Anh, 12A5, LQD High School for Gifted Student*/

const ll INF = 1e9;
const int N = 1e5 + 10;

int ans[N];

void gg(vector<int> a) {
	int p[6];
	for(int i = 0; i < 6; i++) p[i] = a[i];
	answer(p);
}

void orderCoins() {
	int a = getLightest(1, 2, 3);
	int b = getMedian(1, 2, 3);
	int c = 6 - a - b;
	ans[1] = a;
	ans[2] = b;
	ans[3] = c;
	
	int p = getNextLightest(4, 5, 6, ans[1]);
	int f = (p == 4 ? 5 : 4);
	int curr = getHeaviest(p, f, ans[1]);
	if(curr == ans[1]) {
		int r = getMedian(p, f, 15 - p - f);
		f = 15 - p - r;
		return gg({p, r, f, ans[1], ans[2], ans[3]});
	}

	if(curr == p) {
		//f < ans[1] < p
		int l = 15 - f - p;
		int x = getMedian(f, l, ans[2]);
		if(x == f) gg({l, f, ans[1], p, ans[2], ans[3]});
		if(x == l) {
			int t = getMedian(f, l, ans[1]);
			if(t == l) gg({f, l, ans[1], p, ans[2], ans[3]});
			else gg({f, ans[1], p, l, ans[2], ans[3]});
		}
		if(x == ans[2]) {
			int t = getMedian(ans[2], ans[3], l);
			if(t == l) gg({f, ans[1], p, ans[2], l, ans[3]});
			else gg({f, ans[1], p, ans[2], ans[3], l});
		}
	}

	//curr == f
	ans[4] = ans[3];
	ans[3] = ans[2];
	ans[2] = p;
	int x = getMedian(ans[3], ans[4], f);
	if(x == ans[3]) {
		ans[5] = ans[4];
		ans[4] = ans[3];
		ans[3] = f;
	}

	if(x == f) {
		ans[5] = ans[4];
		ans[4] = f;
	}

	if(x == ans[4]) ans[5] = f;

	int l = 15 - p - f;
	int r = getMedian(ans[1], ans[3], l);
	if(r == l) gg({ans[1], ans[2], l, ans[3], ans[4], ans[5]});
	if(r == ans[1]) gg({l, ans[1], ans[2], ans[3], ans[4], ans[5]});
	if(r == ans[3]) {
		r = getMedian(ans[4], ans[5], l);
		if(r == ans[4]) gg({ans[1], ans[2], ans[3], l, ans[4], ans[5]});
		if(r == ans[5]) gg({ans[1], ans[2], ans[3], ans[4], ans[5], l});
		if(r == l) gg({ans[1], ans[2], ans[3], ans[4], l, ans[5]});
	}

	return gg({0});
}

void init(int t) {
	
}

Compilation message

scales.cpp: In function 'void init(int)':
scales.cpp:147:15: warning: unused parameter 't' [-Wunused-parameter]
  147 | void init(int t) {
      |           ~~~~^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Incorrect 1 ms 312 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 1 ms 212 KB Output isn't correct
11 Incorrect 1 ms 212 KB Output isn't correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Incorrect 1 ms 212 KB Output isn't correct
14 Incorrect 1 ms 212 KB Output isn't correct
15 Incorrect 0 ms 212 KB Output isn't correct
16 Incorrect 0 ms 212 KB Output isn't correct
17 Incorrect 1 ms 308 KB Output isn't correct
18 Incorrect 0 ms 212 KB Output isn't correct
19 Incorrect 0 ms 212 KB Output isn't correct
20 Runtime error 1 ms 352 KB Execution killed with signal 6
21 Incorrect 1 ms 212 KB Output isn't correct
22 Runtime error 1 ms 468 KB Execution killed with signal 6
23 Incorrect 1 ms 212 KB Output isn't correct
24 Incorrect 0 ms 212 KB Output isn't correct
25 Runtime error 1 ms 440 KB Execution killed with signal 6
26 Incorrect 0 ms 308 KB Output isn't correct
27 Incorrect 1 ms 212 KB Output isn't correct
28 Incorrect 1 ms 308 KB Output isn't correct
29 Incorrect 1 ms 212 KB Output isn't correct
30 Runtime error 1 ms 468 KB Execution killed with signal 6
31 Runtime error 1 ms 472 KB Execution killed with signal 6
32 Incorrect 0 ms 212 KB Output isn't correct
33 Runtime error 1 ms 468 KB Execution killed with signal 6
34 Incorrect 1 ms 212 KB Output isn't correct
35 Incorrect 1 ms 212 KB Output isn't correct
36 Incorrect 0 ms 212 KB Output isn't correct
37 Incorrect 1 ms 212 KB Output isn't correct
38 Incorrect 0 ms 280 KB Output isn't correct
39 Incorrect 0 ms 212 KB Output isn't correct
40 Runtime error 1 ms 468 KB Execution killed with signal 6