結果
| 問題 |
No.2691 Longest Infection Sequence
|
| コンテスト | |
| ユーザー |
Iroha_3856
|
| 提出日時 | 2024-03-22 21:36:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,237 bytes |
| コンパイル時間 | 1,929 ms |
| コンパイル使用メモリ | 178,112 KB |
| 実行使用メモリ | 39,680 KB |
| 最終ジャッジ日時 | 2024-09-30 11:03:17 |
| 合計ジャッジ時間 | 3,171 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 WA * 3 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for (int i = (int)(l); i<(int)(r); i++)
#define ll long long
const ll INF = 2e18;
int A, B, O, W;
vector<vector<int>> G;
vector<bool> seen;
int ans = 1;
void dfs(int v, int cur) {
seen[v] = true;
ans = max(ans, cur);
int cnt = 0;
for (auto to : G[v]) {
if (!seen[to]) {
cnt++;
dfs(to, cur + 1);
}
}
}
int main() {
cin >> A >> B >> O >> W;
G.resize(A+B+O+W);
rep(i, 0, A) rep(j, 0, A) {
G[i].push_back(j);
}
rep(i, 0, B) rep(j, 0, B) {
G[A+i].push_back(A+j);
}
rep(i, 0, O) rep(j, 0, O) {
G[A+B+i].push_back(A+B+j);
}
rep(i, 0, W) rep(j, 0, W) {
G[A+B+O+i].push_back(A+B+O+j);
}
rep(i, 0, A) rep(j, A+B+O, A+B+O+W) {
G[i].push_back(j);
}
rep(i, A, A+B) rep(j, A+B+O, A+B+O+W) {
G[i].push_back(j);
}
rep(i, A+B+O, A+B+O+W) rep(j, 0, A+B+O) {
G[i].push_back(j);
}
seen.assign(A+B+O+W, false);
dfs(0, 1);
seen.assign(A+B+O+W, false);
dfs(A, 1);
seen.assign(A+B+O+W, false);
dfs(A+B, 1);
seen.assign(A+B+O+W, false);
dfs(A+B+O, 1);
cout << ans << endl;
}
Iroha_3856