結果
| 問題 | No.186 中華風 (Easy) |
| コンテスト | |
| ユーザー |
moti
|
| 提出日時 | 2015-11-29 23:01:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,215 bytes |
| 記録 | |
| コンパイル時間 | 951 ms |
| コンパイル使用メモリ | 107,040 KB |
| 実行使用メモリ | 408,136 KB |
| 最終ジャッジ日時 | 2024-09-14 05:20:36 |
| 合計ジャッジ時間 | 7,556 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | MLE * 1 -- * 22 |
ソースコード
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
using namespace std;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define minimize(a, x) a = std::min(a, x)
#define maximize(a, x) a = std::max(a, x)
typedef unsigned long long ll;
int const inf = 1<<29;
int main() {
int xs[3], ys[3];
rep(i, 3) {
cin >> xs[i] >> ys[i];
}
set<ll> s;
ll curr = xs[0];
rep(i, 1e8) {
s.insert(curr);
curr += ys[0];
if(curr >= std::numeric_limits<ll>::max() - ys[0]) { break; }
}
set<ll> t;
for(auto& e: s) {
if(e % ys[1] == xs[1]) {
t.insert(e);
}
}
curr = xs[2];
for(auto& e: t) {
if(e % ys[2] == xs[2]) {
cout << e << endl;
exit(0);
}
}
cout << -1 << endl;
return 0;
}
moti