結果

問題 No.135 とりあえず1次元の問題
ユーザー hamrayhamray
提出日時 2017-11-15 23:34:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 592 bytes
コンパイル時間 2,455 ms
コンパイル使用メモリ 77,784 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-16 14:28:18
合計ジャッジ時間 3,589 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
#include<stack>
using namespace std;
int main(){
    int N; cin >> N;
    int x = 0;
    vector<int> v;
    for(int i = 0; i < N; i++){
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    for(int i = N-1; i >= 0; i--){
        if(v[N-1] != v[i]){
            cout << v[N-1] - v[i] << endl;
            break;
        }
        if(i == 0){
            cout << 0 << endl;
            break;
        }
    }
    return 0;
}

           
    
0