Submission #775665

# Submission time Handle Problem Language Result Execution time Memory
775665 2023-07-06T17:52:51 Z davitmarg Koala Game (APIO17_koala) C++17
4 / 100
3 ms 336 KB
#include "koala.h"

/*
-----orz------
DavitMargaryan
-----orz------
*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <random>
#include <chrono>
#define mod 998244353ll
#define LL long long
#define LD long double
#define MP make_pair    
#define PB push_back
#define all(v) v.begin(), v.end()
#define fastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

const int N = 500005;

int n, w;

int B[N], R[N];

void query()
{
    for (int i = 0; i < n; i++)
        R[i] = 0;
    playRound(B, R);
}

void query(vector<int> b)
{
    for (int i = 0; i < n; i++)
        B[i] = b[i];
    query();
}

int minValue(int nn, int ww) {
    n = nn;
    w = ww;
    
    B[0] = 1;
    query();

    if(R[0] < 2)
        return 0;

    for(int i = 0; i < n; i++)
        if(R[i] == 0)
            return i;

}

int maxValue(int nn, int ww) {
    n = nn;
    w = ww;

    int res = 0;

    vector<int> cnt(n, 0);

    int k = 0;
    while((1<<k) < n)
        k++;

    for(int i = 0; i < k; i++)
    {
        for(int j = 0; j < n; j++)
            if((1<<j) & i)
                B[j] = 1;
            else
                B[j] = 0;
        query();
        for(int j = 0; j < n; j++)
            if(R[j] > B[j])
                cnt[j]++;
        
        for(int j = 0; j < n; j++)
            if((1<<j) & i)
                B[j] = 0;
            else
                B[j] = 1;
        query();
        for(int j = 0; j < n; j++)
            if(R[j] > B[j])
                cnt[j]++;
    }

    for(int i = 0; i < n; i++)
        if(cnt[i] == k + k)
            res = i;

    return res;
}


int greaterValue(int nn, int ww) {

    return 0;
}

void allValues(int nn, int ww, int *P) {
    if (ww == 2*nn) {
        // TODO: Implement Subtask 4 solution here.
        // You may leave this block unmodified if you are not attempting this
        // subtask.
    } else {
        // TODO: Implement Subtask 5 solution here.
        // You may leave this block unmodified if you are not attempting this
        // subtask.
    }
}


/*

1 1
5 5
3 4 1 5 2

*/

Compilation message

koala.cpp: In function 'int minValue(int, int)':
koala.cpp:69:1: warning: control reaches end of non-void function [-Wreturn-type]
   69 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 3 ms 208 KB Output is correct
3 Correct 3 ms 336 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -