Submission #107096

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1070962019-04-21 22:32:43Noam527Koala Game (APIO17_koala)C++17
100 / 100
73 ms512 KiB
#include <bits/stdc++.h>
#define CHECK cout << "ok" << endl
#define finish(x) return cout << x << endl, 0
typedef long long ll;
typedef long double ldb;
const int md = 1e9 + 7;
const ll inf = 1e18;
const int OO = 1;
const int OOO = 1;
using namespace std;
// returns such i that we get [i, r], [l, i - 1]
int put(int l, int r, int x = -1) {
const int n = 100;
if (x == -1) {
x = n / (r - l + 1);
}
int at = r + 1, cost = 0, sum = 0, cnt = 0;
int best = r + 1;
pair<int, int> mx = { -1, -1 };
while (at > l && cost + x + 1 <= n) {
at--;
sum += at;
cnt++;
cost += x + 1;
}
vector<int> other;
for (int i = n; i >= 1; i--) {
if (i < l || r < i) other.push_back(i);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

koala.cpp: In function 'int put(int, int, int)':
koala.cpp:32:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (pos + 1 < other.size() && cost < n) {
         ~~~~~~~~^~~~~~~~~~~~~~
koala.cpp:46:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while (pos + 1 < other.size() && cost < n) {
          ~~~~~~~~^~~~~~~~~~~~~~
koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:113:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while (p1 < prev.size() && p2 < cur.size()) {
          ~~~^~~~~~~~~~~~~
koala.cpp:113:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while (p1 < prev.size() && p2 < cur.size()) {
                              ~~~^~~~~~~~~~~~
#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...