結果

問題 No.1352 Three Coins
ユーザー blackyukiblackyuki
提出日時 2021-01-13 20:19:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 2,483 ms
コンパイル使用メモリ 207,192 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-07 05:50:03
合計ジャッジ時間 11,437 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
5,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 WA -
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 WA -
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 TLE -
testcase_33 AC 2 ms
5,376 KB
testcase_34 WA -
testcase_35 AC 125 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;cin>>a>>b>>c;
    assert(1<=a&&a<=2000);
    assert(1<=b&&b<=2000);
    assert(1<=c&&c<=2000);
    if(__gcd(a,__gcd(b,c))!=1){
        cout<<"INF"<<endl;
        return 0;
    }
    vector<bool> dp(10000000,false);
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        auto t=q.front();q.pop();
        if(t+a<dp.size()&&!dp[t+a]){
            dp[t+a]=true;q.push(t+a);
        }
        if(t+b<dp.size()&&!dp[t+b]){
            dp[t+b]=true;q.push(t+b);
        }
        if(t+c<dp.size()&&!dp[t+c]){
            dp[t+c]=true;q.push(t+c);
        }
    }
    int ans=0;
    for(int i=1;i<10000000;i++)if(!dp[i]){
        ans++;
        cout<<i<<endl;
    }
    cout<<ans<<endl;
}
0