結果

問題 No.365 ジェンガソート
ユーザー dnish
提出日時 2017-05-03 06:58:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 376 bytes
コンパイル時間 1,586 ms
コンパイル使用メモリ 167,052 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-09-14 05:11:39
合計ジャッジ時間 5,502 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 7 TLE * 1 -- * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
#define ck(n,a,b) ((a)<=(n)&&(n)<(b))
using namespace std;

int main(){
	int N;
	cin>>N;
	int a[100010];
	REP(i,0,N)	cin>>a[i];
	int ans,mx;
	ans=mx=0;
	REP(i,0,N){
		if(mx>a[i]) continue;
		REP(j,i+1,N){
			if(ck(a[j],mx,a[i])) ans++;
		}
		mx=a[i];
	}
	p(ans);
	return 0;
}
0