結果

問題 No.1603 Manhattan Social Distance
ユーザー 👑 Nachia
提出日時 2021-07-16 21:28:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 602 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 72,596 KB
最終ジャッジ日時 2025-01-23 01:21:34
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

// Nachia くんだよ

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
  ll N,H,W; cin >> N >> H >> W;
  H--; W--;
  ll c = N / 4;
  ll ans = (c*N/2 + c*(N%4)) * 2*(W+H);
  if(W < H) swap(W,H);
  if(N % 4 == 1) ans += W;
  if(N % 4 == 2) ans += H+W;
  if(N % 4 == 3) ans += 2 * (H+W);
  cout << ans << endl;
  return 0;
}


struct ios_do_not_sync{
  ios_do_not_sync(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
  }
} ios_do_not_sync_instance;


0