# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1017731 | Gray | Red-blue table (IZhO19_stones) | C++17 | 52 ms | 5308 KiB |
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 <cassert>
#include <iostream>
#include <set>
#include <vector>
#define ll int
#define ln "\n"
#define ff first
#define ss second
#define ld long double
const ll INF = 1e9;
const ll MOD = 1e9+7;
using namespace std;
void solve(){
ll n, m; cin >> n >> m;
ll nform = n/2+1, mforn=m/2+1;
cout << max((n-nform)*m/mforn+m,(m-mforn)*n/nform+n) << ln;
if ((n-nform)*m/mforn+m>(m-mforn)*n/nform+n){
vector<vector<ll>> ans(n, vector<ll>(m));
multiset<pair<ll, ll>> vac;
for (ll i=0; i<(n-nform)*m/mforn; i++){
vac.insert({0, i});
}
for (ll j=0; j<m; j++){
for (ll i=0; i<n-nform; ++i){
auto cur = *vac.begin();
vac.erase(vac.begin());
assert(ans[cur.ss][j]==0);
ans[cur.ss][j]=2;
vac.insert({cur.ff+1, cur.ss});
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |