This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <bitset>
#include <math.h>
#include <fstream>
#include <iomanip>
#include "koala.h"
using namespace std;
using ll = int;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vvvvll = vector<vvvll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vld = vector<ld>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using pb = pair<bool, bool>;
using vpb = vector<pb>;
using vvpb = vector<vpb>;
using vi = vector<int>;
using vvi = vector<vi>;
const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e18;
#define F first
#define S second
#define FAST ios_base::sync_with_stdio(0)
#define FASTIN cin.tie(0)
#define FASTOUT cout.tie(0)
#define upmin(a, b) a = min(a, b)
#define upmax(a, b) a = max(a, b)
#define whatvec(v) cout << #v << ": "; for(auto it = v.begin(); it != v.end(); ++it) cout << *it << " "; cout << endl;
#define prv(v) cout << #v << ": "; for(auto it = v.begin(); it != v.end(); ++it) cout << *it << " "; cout << endl;
#define wpr(x) cout << #x << " = " << (x) << endl;
#define wprv(v) cout << #v << ": "; for(auto it = v.begin(); it != v.end(); ++it) cout << *it << " "; cout << endl;
#define what(x) cout << #x << " = " << (x) << "\n";
#define pr(x) cout <<x << endl;
#define rep(i,s,e) for(ll i = s;i < e; i++)
#define all(x) x.begin(),x.end()
#define pb push_back
const ll len = 6;
ll a[len], b[len];
void fill(ll ind)
{
for (ll i = 0; i < len; i++) a[i] = 0;
a[ind] = 1;
}
int minValue(int N, int W) {
// TODO: Implement Subtask 1 solution here.
// You may leave this function unmodified if you are not attempting this
// subtask.
ll n = N, w = W;
//vll a(n, 1);
fill(0);
rep(i, 0, len) b[i] = -1;
bool ok = false;
playRound(a, b);
rep(i, 0, len) if (b[i] != -1) ok = true;
if (!ok) while (true);
for (ll i = 0; i < len; i++) {
if (b[i] == 0) return i;
}
fill(1);
playRound(a, b);
rep(i, 0, len) {
if (b[i] == 0) return i;
}
while (true);
return 0;
}
int rec(vll ind)
{
if (ind.size() == 1) {
return ind[0];
}
ll sz = ind.size();
ll cap = len / sz;
rep(i, 0, len) {
a[i] = 0;
}
rep(i, 0, sz) {
a[ind[i]] = cap;
}
/*
pr("a:");
rep(i, 0, len) {
cout << a[i] << " ";
}
cout << endl;
*/
playRound(a, b);
/*
pr("b:");
rep(i, 0, len) {
cout << b[i] << " ";
}
cout << endl;
*/
ll maxv = 0;
rep(i, 0, len) {
upmax(maxv, b[i]);
}
vll nind;
rep(i, 0, len) {
if (b[i] == maxv) nind.push_back(i);
}
return rec(nind);
}
int maxValue(int N, int W) {
// TODO: Implement Subtask 2 solution here.
// You may leave this function unmodified if you are not attempting this
// subtask.
vll ind;
for (ll i = 0; i < len; i++) ind.push_back(i);
return rec(ind);
}
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.
}
}
/*
2 1
6 6
5 3 2 1 6 4
*/
Compilation message (stderr)
koala.cpp: In function 'int minValue(int, int)':
koala.cpp:82:8: warning: unused variable 'n' [-Wunused-variable]
82 | ll n = N, w = W;
| ^
koala.cpp:82:15: warning: unused variable 'w' [-Wunused-variable]
82 | ll n = N, w = W;
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |