Submission #97229

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
972292019-02-14 13:54:29E869120Koala Game (APIO17_koala)C++14
100 / 100
81 ms680 KiB
#include "koala.h"
#include <iostream>
#include <vector>
using namespace std;
int D[109], R[109];
void preset() {
for (int i = 0; i < 109; i++) { D[i] = 0; R[i] = 0; }
}
int minValue(int N, int W) {
preset(); D[0] = 1;
playRound(D, R);
for (int i = 0; i < N; i++) {
if (D[i] >= R[i]) return i;
}
return -1;
}
int maxValue(int N, int W) {
int P[4] = { 1, 2, 4, 11 };
vector<int>I; for (int i = 0; i < N; i++) I.push_back(i);
for (int i = 0; i < 4; i++) {
preset();
for (int j = 0; j < I.size(); j++) D[I[j]] = P[i];
playRound(D, R);
vector<int>II; for (int j = 0; j < I.size(); j++) { if (D[I[j]] < R[I[j]]) II.push_back(I[j]); }
I = II;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:26:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < I.size(); j++) D[I[j]] = P[i];
                   ~~^~~~~~~~~~
koala.cpp:28:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   vector<int>II; for (int j = 0; j < I.size(); j++) { if (D[I[j]] < R[I[j]]) II.push_back(I[j]); }
                                  ~~^~~~~~~~~~
koala.cpp: In function 'std::vector<int> mergesort(int, std::vector<int>)':
koala.cpp:74:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < J.size() / 2; i++) J1.push_back(J[i]);
                  ~~^~~~~~~~~~~~~~
koala.cpp:75:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = J.size() / 2; i < J.size(); i++) J2.push_back(J[i]);
                             ~~^~~~~~~~~~
koala.cpp:81:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (cl == J1.size()) { L.push_back(K2[cr]); cr++; }
       ~~~^~~~~~~~~~~~
koala.cpp:82:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   else if (cr == J2.size()) { L.push_back(K1[cl]); cl++; }
            ~~~^~~~~~~~~~~~
koala.cpp: In function 'void solve(int, int, int, int, std::vector<int>)':
koala.cpp:154:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int j = 0; j < vec.size(); j++) D[vec[j]] = Z;
                  ~~^~~~~~~~~~~~
koala.cpp:158:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int j = 0; j < vec.size(); j++) {
                  ~~^~~~~~~~~~~~
#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...