結果

問題 No.406 鴨等間隔の法則
ユーザー tottoripapertottoripaper
提出日時 2016-10-20 20:39:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 842 bytes
コンパイル時間 1,753 ms
コンパイル使用メモリ 151,212 KB
実行使用メモリ 8,980 KB
最終ジャッジ日時 2023-09-21 18:18:16
合計ジャッジ時間 3,821 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
5,440 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 42 ms
7,984 KB
testcase_05 AC 14 ms
5,120 KB
testcase_06 AC 15 ms
5,248 KB
testcase_07 AC 15 ms
5,184 KB
testcase_08 AC 42 ms
8,072 KB
testcase_09 AC 46 ms
8,388 KB
testcase_10 AC 17 ms
5,512 KB
testcase_11 AC 36 ms
7,388 KB
testcase_12 AC 24 ms
5,924 KB
testcase_13 AC 21 ms
5,708 KB
testcase_14 AC 44 ms
7,904 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 4 ms
4,376 KB
testcase_20 AC 6 ms
4,380 KB
testcase_21 AC 7 ms
4,380 KB
testcase_22 AC 11 ms
4,744 KB
testcase_23 AC 24 ms
6,244 KB
testcase_24 AC 38 ms
7,328 KB
testcase_25 AC 46 ms
8,444 KB
testcase_26 AC 54 ms
8,812 KB
testcase_27 AC 12 ms
4,380 KB
testcase_28 AC 34 ms
8,492 KB
testcase_29 AC 54 ms
8,980 KB
testcase_30 AC 53 ms
8,768 KB
testcase_31 AC 43 ms
8,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using ll = long long;
using P = std::tuple<int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

int kamo[100000], diffs[100000];
set<int> s;

int main(){
    //*
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    /*/
      /*/

    int N;
    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> kamo[i];

        s.insert(kamo[i]);
    }
    
    if(s.size() != N){
        puts("NO");
        return 0;
    }
    
    sort(kamo, kamo+N);
    adjacent_difference(kamo, kamo+N, diffs);
    
    for(int i=1;i<N;++i){
        if(diffs[i] != diffs[1]){
            puts("NO");
            return 0;
        }
    }

    puts("YES");
}
0