結果

問題 No.1242 高橋君とすごろく
ユーザー DriceDrice
提出日時 2020-10-02 23:15:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,031 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 45,172 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-27 08:45:37
合計ジャッジ時間 1,342 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<cstdio>
#include<algorithm>
int f[1005];
long long a[105];

int main(){
    long long upper = 100;
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i = 1; i <= k; i++) scanf("%lld",&a[i]);
    std::sort(a+1,a+1+k);
    int find = 0;
    for(int i = 1; i <= k; i++){
        if(a[i]<=upper) f[a[i]] = 1;
        for(int j = i+1; j <= k; j++){
            long long u = a[i], v = a[j];
            long long diff = v-u;
            if(diff==1 || diff==3 || diff==5){
                if(u>=upper) find = 1;
            } 
        }
    }
    if(find) printf("No\n");
    else{
        for(int i = upper; i >= 1; i--){
            if(f[i]) continue;
            for(int x = 1; x <= 3; x++){
                int y = 7-x;
                if(i+x<=upper && i+y<=upper && f[i+x] && f[i+y]) f[i] = 1;
            }
            //printf("f[%d] = %d\n",i,f[i]);
        }
        if(f[1]) printf("No\n");
        else printf("Yes\n");
    }
    return 0;
}

/*
1
11111111111011010011
3
11111111111101101001
5
11111101101001100001
*/
0