結果

問題 No.365 ジェンガソート
ユーザー hanorver
提出日時 2016-04-29 22:36:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 379 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 62,664 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-04 18:17:55
合計ジャッジ時間 17,604 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 25 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>

int main() {
	int n;

	std::cin >> n;

	std::vector<int> v(n);

	for (int i = 0; i < n; i++) {
		std::cin >> v[i];
	}

	int count = 0;
	for (int i = 1; i < n; i++) {
		auto it = std::find(v.begin(), v.end(), i);
		if (it - v.begin() != 0) {
			count++;
		}
		v.erase(it);
	}

	std::cout << count << std::endl;
	return 0;
}
0