結果
| 問題 |
No.1934 Four Fruits
|
| コンテスト | |
| ユーザー |
skojiji
|
| 提出日時 | 2022-05-14 00:25:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,845 bytes |
| コンパイル時間 | 2,151 ms |
| コンパイル使用メモリ | 203,420 KB |
| 最終ジャッジ日時 | 2025-01-29 07:48:59 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/mincostflow>
#include <atcoder/modint>
using namespace atcoder;
using namespace std;
#define REP(i, m, n) for (int64_t i = (int64_t)(m); i < (int64_t)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define RREP(i, m, n) for (int64_t i = (int64_t)(m - 1); i >= (int64_t)(n); i--)
#define rrep(i, n) RREP(i, n, 0)
#define all(v) v.begin(), v.end()
using vi = vector<int64_t>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using vvs = vector<vs>;
using vd = vector<long double>;
using vvd = vector<vd>;
using pii = pair<int64_t, int64_t>;
using tii = tuple<int64_t, int64_t, int64_t>;
using vp = vector<pii>;
using vvp = vector<vp>;
using vt = vector<tii>;
using vvt = vector<vt>;
using mint = modint;
using vm = vector<mint>;
using vvm = vector<vm>;
using mii = map<int64_t, int64_t>;
using pdi = pair<long double, int64_t>;
using tdi = tuple<long double, int64_t, int64_t>;
const int64_t INF = 2e18;
const vp dxy = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}};
template <typename T>
bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T>
bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
int64_t to_int(char c) { return c - 'a'; }
int64_t a, b, c;
bool forall(mii &cnt, int64_t i) {
for (auto [k, v] : cnt)
if (v != i) return false;
return true;
}
bool check(int64_t i) {
if (a == b && b == c && c == i) return true;
mii cnt;
cnt[a]++;
cnt[b]++;
cnt[c]++;
cnt[i]++;
REP(i, 1, 2 + 1) if (forall(cnt, i)) return true;
return false;
}
int main() {
cin >> a >> b >> c;
int64_t n = 4;
rep(i, n) {
if (check(i)) {
cout << i << endl;
return 0;
}
}
}
skojiji