結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー tashikanitashikani
提出日時 2016-10-15 00:07:54
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,625 bytes
コンパイル時間 1,213 ms
コンパイル使用メモリ 108,436 KB
実行使用メモリ 28,480 KB
最終ジャッジ日時 2024-05-01 23:56:41
合計ジャッジ時間 11,952 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:51:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   51 |                 scanf("%d %d %d", &s, &p, &u);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MP make_pair
#define MT make_tuple
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

int main() {

	int N, K;
	cin >> N >> K;

	vector<map<int, map<int, priority_queue<PII>>>> M(11);
	REP(i, N){
		int s, p, u;
		scanf("%d %d %d", &s, &p, &u);
		M[s][0][u].push(MP(-p, i));
		//cout << M[s][0].size() << endl;
	}

	int i = 10;
	while(K--){
		int best = 100000000, u = -1;
		REP(j, 11){
			EACH(m, M[i][j]){
				//cout << j << " u : " << m.first << " " << m.second.empty() <<  endl;
				if(m.second.empty()) continue;
				PII tmp = m.second.top();
				//cout << tmp.first << " " << tmp.second << endl;
				if(tmp.first < best){
					best = tmp.first;
					u = m.first;
				}
			}
			if(u >= 0){
				PII tmp = M[i][j][u].top();
				printf("%d\n", tmp.second);
				M[i][j][u].pop();
				swap(M[i][j + 1][u], M[i][j][u]);
				break;
			}
		}
		if(u < 0){
			K++;
			i--;
		}
	}


	return 0;
}
0