結果
| 問題 |
No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-15 00:07:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,625 bytes |
| コンパイル時間 | 1,098 ms |
| コンパイル使用メモリ | 108,444 KB |
| 実行使用メモリ | 25,728 KB |
| 最終ジャッジ日時 | 2024-11-22 08:22:58 |
| 合計ジャッジ時間 | 66,744 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 10 RE * 27 TLE * 9 |
コンパイルメッセージ
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);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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;
}