結果
問題 | No.365 ジェンガソート |
ユーザー |
![]() |
提出日時 | 2016-04-29 22:38:00 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 552 bytes |
コンパイル時間 | 484 ms |
コンパイル使用メモリ | 60,436 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-12 01:41:06 |
合計ジャッジ時間 | 2,145 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 41 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;#define RREP(i,s,e) for (i = s; i >= e; i--)#define rrep(i,n) RREP(i,n-1,0)#define REP(i,s,e) for (i = s; i < e; i++)#define rep(i,n) REP(i,0,n)#define INF 100000000typedef long long ll;int main() {int i, n, mx, cnt;int a[100000];cin >> n;rep (i,n) cin >> a[i];mx = *max_element(a,a+n);cnt = 0;rrep (i,n) {if (a[i] == mx) {cnt++;mx--;}}cout << n-cnt << endl;return 0;}