답안 #200839

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
200839 2020-02-08T09:39:25 Z BThero 코알라 (APIO17_koala) C++17
33 / 100
109 ms 380 KB
// Why am I so dumb? :c
// chrono::system_clock::now().time_since_epoch().count()
                                                  
#include<bits/stdc++.h>
#include "koala.h"
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;   
typedef pair<int, int> pii;
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int minValue(int N, int W) {
    int me[N], you[N];

    for (int i = 0; i < N; ++i) {
        me[i] = 0;
    }

    me[0] = 1;
    playRound(me, you);
    int i = 0;

    while (you[i]) {
        ++i;
    }

    return i;
}

int maxValue(int N, int W) {
    int me[N], you[N];
    vector<int> v;

    for (int i = 0; i < N; ++i) {
        v.pb(i);
    }

    while (v.size() > 1) {
        int sz = v.size();
        int k = (W + sz) / sz - 1;
        fill(me, me + N, 0);
                
        // v.size() > k

        for (int x : v) {
            me[x] = k;
        }

        playRound(me, you);

        vector<int> nv;

        for (int x : v) {
            if (you[x] > me[x]) {
                nv.pb(x);
            }
        }

        assert(!nv.empty());
        v = nv;            
    }
    
    return v[0];
}

int greaterValue(int N, int W) {
    int me[N], you[N];

    for (int i = 0; i < N; ++i) {
        me[i] = you[i] = 0;
    }

    int L = 1, R = min(W / 2, 8);

    while (L <= R) {
        int x = (L + R) >> 1;
        me[0] = me[1] = x;
        playRound(me, you);

        if (you[0] != you[1]) {
            return you[1] > you[0];
        }

        if (you[0] > 0) {
            L = x + 1;
        }
        else {
            R = x - 1;
        }
    }
}

void allValues(int N, int W, int *P) {
    if (W == 2*N) {
    
    } 
    else {
    
    }
}

Compilation message

koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:103:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 376 KB Output is correct
2 Correct 10 ms 380 KB Output is correct
3 Correct 10 ms 380 KB Output is correct
4 Correct 10 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 376 KB Output is correct
2 Correct 22 ms 376 KB Output is correct
3 Correct 22 ms 248 KB Output is correct
4 Correct 22 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 94 ms 376 KB Output is partially correct
2 Partially correct 109 ms 248 KB Output is partially correct
3 Partially correct 93 ms 348 KB Output is partially correct
4 Partially correct 93 ms 248 KB Output is partially correct
5 Partially correct 95 ms 252 KB Output is partially correct
6 Partially correct 94 ms 252 KB Output is partially correct
7 Partially correct 95 ms 352 KB Output is partially correct
8 Partially correct 98 ms 380 KB Output is partially correct
9 Partially correct 91 ms 364 KB Output is partially correct
10 Partially correct 90 ms 356 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -