結果

問題 No.186 中華風 (Easy)
ユーザー kosakkunkosakkun
提出日時 2016-12-27 18:07:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,281 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 96,396 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-21 15:00:17
合計ジャッジ時間 2,560 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 33 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 33 ms
4,380 KB
testcase_20 AC 32 ms
4,376 KB
testcase_21 AC 33 ms
4,376 KB
testcase_22 AC 33 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

int main(){
    
    ll X[3],Y[3];
    REP(i,3)cin>>X[i]>>Y[i];
    
    set<ll> k1,k2;
    ll ans=1e9;
    for(ll i=0;i<=1e6;i++)if(i%Y[0]==X[0])k1.insert(i);
    for(ll i=0;i<=1e6;i++)if(i%Y[1]==X[1])k2.insert(i);
    for(ll i=0;i<=1e6;i++){
        if(i%Y[2]==X[2]){
            if( k1.find(i)!=k1.end() && k2.find(i)!=k2.end() ){
                if(i!=0)ans=min(ans,i);
            }
        }
    }
    
    if(ans==1e9)cout<<-1<<endl;
    else cout<<ans<<endl;
    
    return 0;
}
0