結果

問題 No.504 ゲーム大会(ランキング)
ユーザー GB
提出日時 2018-11-09 01:04:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 671 bytes
コンパイル時間 864 ms
コンパイル使用メモリ 66,116 KB
実行使用メモリ 17,932 KB
最終ジャッジ日時 2024-11-20 21:13:42
合計ジャッジ時間 25,845 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;

typedef long long ll;

int main() {

	int n = 0;
	cin >> n;
	vector<ll> ranking,array;
	int k_ranking = 1;
	int k_score = 0;
	for (int i = 0;i < n;i++) {
		ll buff = 0;
		cin >> buff;
		array.push_back(buff);
	}
	for (int i = 0;i < n;i++) {
		ll buff = 0;
		buff = array[i];
		ranking.push_back(buff);
		if (ranking.size() == 1) {
			k_score = buff;
			cout << 1 << endl;
			continue;
		}
		sort(ranking.begin(), ranking.end(),greater<ll>());
		auto itr = find(ranking.begin(),ranking.end(),k_score);
		int index = distance(ranking.begin(),itr);
		cout << index + 1 << endl;
	}


	return 0;
}
0