提出 #20534268
ソースコード 拡げる
#include <bits/stdc++.h>
#include <atcoder/all>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace atcoder;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = long long;
#define pint pair<int, int>
#define pll pair<ll, ll>
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
// const ll mod = 1e9 + 7;
using Bint = boost::multiprecision::cpp_int;
using mint = modint1000000007;
int main() {
int t;
cin >> t;
while(t--){
ll x, y, p, q;
cin >> x >> y >> p >> q;
vector<ll> mod(2);
mod[1] = 2 * x + 2 * y;
mod[0] = p + q;
ll ans = longinf;
for (ll i = p; i < p + q;i++) {
for (ll j = x; j < x + y;j++){
vector<ll> rem(2);
rem[0] = i;
rem[1] = j;
auto temp=crt(rem, mod);
if(temp.second)ans = min(ans,temp.first);
}
}
if(ans<longinf){
cout << ans << endl;
}else{
cout << "infinity" << endl;
}
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | E - Oversleeping |
| ユーザ | hnakashima |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 500 |
| コード長 | 1049 Byte |
| 結果 | AC |
| 実行時間 | 245 ms |
| メモリ | 3576 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 500 / 500 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 01_sample.txt |
| All | 01_sample.txt, 02_hand.txt, 03_hand.txt, 04_small.txt, 05_small.txt, 06_small.txt, 07_small.txt, 08_small.txt, 09_inf.txt, 10_inf.txt, 11_inf.txt, 12_large.txt, 13_large.txt, 14_large.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01_sample.txt | AC | 7 ms | 3464 KiB |
| 02_hand.txt | AC | 2 ms | 3452 KiB |
| 03_hand.txt | AC | 3 ms | 3416 KiB |
| 04_small.txt | AC | 3 ms | 3504 KiB |
| 05_small.txt | AC | 2 ms | 3416 KiB |
| 06_small.txt | AC | 2 ms | 3508 KiB |
| 07_small.txt | AC | 2 ms | 3484 KiB |
| 08_small.txt | AC | 2 ms | 3576 KiB |
| 09_inf.txt | AC | 2 ms | 3552 KiB |
| 10_inf.txt | AC | 2 ms | 3572 KiB |
| 11_inf.txt | AC | 2 ms | 3452 KiB |
| 12_large.txt | AC | 117 ms | 3484 KiB |
| 13_large.txt | AC | 173 ms | 3572 KiB |
| 14_large.txt | AC | 245 ms | 3416 KiB |