Submission #887799

# Submission time Handle Problem Language Result Execution time Memory
887799 2023-12-15T08:42:25 Z vjudge1 Koala Game (APIO17_koala) C++17
19 / 100
15 ms 600 KB
/****************************D A N E T****************************
***     ██████╗     █████╗    ███╗    ██╗   ███████╗ ████████╗   ***
***     ██╔══██╗   ██╔══██╗   ████╗   ██║   ██╔════╝ ╚══██╔══╝   ***
***     ██║   ██║  ███████║   ██╔██╗  ██║   █████╗      ██║      ***
***     ██║   ██║  ██╔══██║   ██║╚██╗ ██║   ██╔══╝      ██║      ***
***     ██████╔╝   ██║  ██║   ██║  ╚████║   ███████╗    ██║      ***
***     ╚═════╝    ╚═╝  ╚═╝   ╚═╝   ╚═══╝   ╚══════╝    ╚═╝      ***   
****************************D A N E T****************************/
#include <bits/stdc++.h>
#include "koala.h"
using namespace std;
/**************************P R A G M As**************************/
#pragma GCC optimize("O3")
/**************************D E F I N Es**************************/
#define Tof_Io  		ios_base::sync_with_stdio(false);cin.tie(0) , cout.tie(0);
//#define int  			long long int
#define double  		long double
#define pb				push_back
#define endl 			'\n'
/*****************D E F I N Es-F U N C T I O Nes*****************/
#define debug(x)    	cerr << #x << ": " << x << endl
#define kill(x)     	cout << x << endl, exit(0)
#define all(x) 			x.begin(),x.end()
#define yes             cout << "Yes"
#define no              cout <<"No"
/***************************C O N S Ty***************************/
const double 			PI = 3.141592653589793;
const int 				mod = 998244353;//1e9+7 998244353
const int 				inf = 1e9+9;
const int 				logt = 18;
const int               maxN = 500 + 23;
/***************************B U I L Dy***************************/
int fac[maxN];
int inv[maxN];
vector<int> adj[maxN];
bool seen[maxN][maxN];
string str;
int n, m;
vector<pair<int, int> > dx = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
/****************************N O T Ey****************************/
/*

*/
/***********************F U N C T I O N es***********************/
int  dnt_pow	(int a, int b, int md = mod){int ans = 1; while(b){if(b&1){ans = (a*ans)%md;}a = (a*a)%md;b >>= 1;}return ans ;}
void dnt_bld	(){fac[0] = 1; inv[0] = dnt_pow(fac[0],mod-2) ;for(int i = 1 ; i < maxN ; i++) {fac[i] = (fac[i-1] * i) % mod;inv[i] = dnt_pow( fac[i] , mod-2);}}
int  dnt_ncr	(int n,int r){return fac[n] * inv[r] % mod * inv[n-r] % mod;}
void dnt_cal(int e, int s) {seen[e][s] = 1;for(auto x : str) {if(x == 'N') e--;if(x == 'S') e++;if(x == 'W') s--;if(x == 'E') s++;seen[e][s] = 1;}}

/****************************************************************/ 
/****************************************************************/
/****************************************************************/
/****************************************************************/
/****************************************************************/
int greaterValue(int N, int W) {
    // TODO: Implement Subtask 3 solution here.
    // You may leave this function unmodified if you are not attempting this
    // subtask.
    return 0;
}

void allValues(int N, int W, int *P) {
    if (W == 2*N) {
        // 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.
    }
}

/****************************************************************/
/****************************************************************/
/****************************************************************/
/****************************************************************/
/****************************************************************/
int minValue(int N, int W) 
{
    int a[N];
    int b[N];
    vector<int> vc(N);
    for(int i = 0; i < N; i++)
    {
        a[i] = 1;
    }
    playRound(a, b);
    int cnt = 0;
    for (int i = 0; i < N; i++) 
    {
        a[i] = 0;
        if (b[i] != 0)
        {
            if(cnt == 0) 
            {
                a[i] = 98;
                cnt++;
            }
            else if(cnt == 1) 
            {
                a[i] = 2;
                cnt++;
            }
        }
    }
    playRound(a, b);
    for (int i = 0; i < N; i++)
    {
        if(a[i] == b[i])
        {
            return i;
            //vc.pb(i);
        }
    }
}
int maxValue(int N, int W) 
{
    int a[N];
    int b[N];
    vector<int> vc(N);
    iota(all(vc), 0);
    while (vc.size() >= 2) 
    {
        fill(a, a + N, 0);
        for(int i = 0; i < vc.size(); i++)
        {
            a[vc[i]] = W / vc.size();
        }
        //
        playRound(a, b);
        vc.clear();
        //
        for (int i = 0; i < N; i++) 
        {
            if (b[i] > a[i] and a[i])
            {
                vc.push_back(i);
            }
            
        }
    }
    return vc[0];
}
 

Compilation message

koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:126:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  126 |         for(int i = 0; i < vc.size(); i++)
      |                        ~~^~~~~~~~~~~
koala.cpp: In function 'int minValue(int, int)':
koala.cpp:83:21: warning: control reaches end of non-void function [-Wreturn-type]
   83 |     vector<int> vc(N);
      |                     ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 360 KB Output is correct
2 Correct 10 ms 344 KB Output is correct
3 Correct 13 ms 600 KB Output is correct
4 Correct 10 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -