結果

問題 No.365 ジェンガソート
ユーザー ldsyb
提出日時 2016-04-29 22:53:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 319 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 67,780 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-04 18:32:58
合計ジャッジ時間 1,867 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
	int ans = 0,ans2 = 0,n;
	cin >> n;
	int a[n];
	for(int i = 0;i < n;i++){
		cin >> a[i];
		if(i != 0 && a[0] > a[i]) ans++;
	}
	for(int i = n - 1;i--;) if(a[i] > a[i + 1]) ans2++;
	cout << (a[0] == *max_element(a,a + n) ? ans : ans2) << endl;
}
0