結果
| 問題 |
No.1603 Manhattan Social Distance
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-07-16 22:56:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 2,000 ms |
| コード長 | 613 bytes |
| コンパイル時間 | 630 ms |
| コンパイル使用メモリ | 73,012 KB |
| 最終ジャッジ日時 | 2025-01-23 02:32:46 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
// 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*(c-1)/2*4 + c*2 + c*(N%4)) * 2*(W+H);
if(W < H) swap(W,H);
if(N % 4 == 1) ans += 0;
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;
Nachia