結果
問題 | No.643 Two Operations No.2 |
ユーザー |
![]() |
提出日時 | 2018-02-02 21:37:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 544 bytes |
コンパイル時間 | 2,061 ms |
コンパイル使用メモリ | 174,920 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-31 07:17:09 |
合計ジャッジ時間 | 2,809 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {set<pair<int64_t, int64_t>> s;{pair<int64_t, int64_t> p;cin >> p.first >> p.second;s.insert(p);}for (int64_t ans = 0; ans < 50; ans++) {set<pair<int64_t, int64_t>> next;for (auto p : s) {if (p.first == p.second) {cerr << p.first << ' ' << p.second << endl;cout << ans << endl;return 0;}next.insert({p.second, p.first});next.insert({p.first + p.second, p.first - p.second});}swap(s, next);}cout << -1 << endl;return 0;}