Submission #129179

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1291792019-07-11 19:17:13keko37Koala Game (APIO17_koala)C++14
100 / 100
82 ms984 KiB
#include <bits/stdc++.h>
#include "koala.h"
using namespace std;
const int MAXN = 105;
int n, w, flg;
int dp[105][105];
int B[MAXN], R[MAXN];
bool f (int ll, int rr, int c) {
vector <int> a, b;
for (int i = n; i >= 1; i--) {
if (ll <= i && i <= rr) {
if (a.empty()) a.push_back(i); else a.push_back(a.back() + i);
} else {
if (b.empty()) b.push_back(i); else b.push_back(b.back() + i);
}
}
vector < pair <int, int> > res;
int mx = -1;
for (int i=0; i<=a.size(); i++) {
for (int j=0; j<=b.size(); j++) {
int cost = i * (c + 1) + j;
int val = 0;
if (i > 0) val += a[i-1];
if (j > 0) val += b[j-1];
if (cost <= w) {
if (val > mx) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

koala.cpp: In function 'bool f(int, int, int)':
koala.cpp:23:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=0; i<=a.size(); i++) {
                ~^~~~~~~~~~
koala.cpp:24:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j=0; j<=b.size(); j++) {
                 ~^~~~~~~~~~
koala.cpp:41:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (par.first == 0 || par.first == a.size()) return 0;
                         ~~~~~~~~~~^~~~~~~~~~~
koala.cpp: In function 'int minValue(int, int)':
koala.cpp:93:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:127:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...