Submission #775783

# Submission time Handle Problem Language Result Execution time Memory
775783 2023-07-06T23:20:24 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> p;
    for(int i = 0; i < n; i++)
        p.push_back(i);

    int k = 1;

    while(p.size() > 1)
    {
        for(int i = 0; i < n; i++)
            B[i] = 0;
        for(int i = 0; i < p.size(); i++)
            B[p[i]] = k;
        query();
        vector<int> np;
        for(int i = 0; i < p.size(); i++)
            if(R[p[i]] > B[p[i]])
                np.push_back(p[i]);
        p = np;
        k+=2;
    }

    return p[0];
}


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.
    }
}


/*

2 1
5 5
3 5 4 1 2

2 1
6 6 
5 3 2 1 4 6


*/

Compilation message

koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:88:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   88 |         for(int i = 0; i < p.size(); i++)
      |                        ~~^~~~~~~~~~
koala.cpp:92:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   92 |         for(int i = 0; i < p.size(); i++)
      |                        ~~^~~~~~~~~~
koala.cpp:75:9: warning: unused variable 'res' [-Wunused-variable]
   75 |     int res = 0;
      |         ^~~
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 336 KB Output is correct
2 Correct 3 ms 336 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 0 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 -