Submission #1017731

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10177312024-07-09 09:44:55GrayRed-blue table (IZhO19_stones)C++17
100 / 100
52 ms5308 KiB
#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});
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...