結果
| 問題 |
No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
|
| コンテスト | |
| ユーザー |
chakku
|
| 提出日時 | 2016-10-14 23:19:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,870 bytes |
| コンパイル時間 | 2,089 ms |
| コンパイル使用メモリ | 194,516 KB |
| 実行使用メモリ | 33,816 KB |
| 最終ジャッジ日時 | 2024-11-22 10:23:59 |
| 合計ジャッジ時間 | 169,242 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 13 TLE * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
#define CININIT cin.tie(0),ios::sync_with_stdio(false)
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
constexpr ll mod = 1e9+7;
int main(){
using tu = tuple<int,int>;
int N,K;cin>>N>>K;
vi S(N),P(N),U(N);
map<int,set<pii>> mp;
map<tu,int> dic;
map<pii,int> dicu;
rep(i,N){
int s,p,u;
cin>>s>>p>>u;
u--;
dic[make_tuple(s,p)] = i;
mp[s].insert(pii(p,u));
dicu[make_pair(s,p)] = u;
}
vector<int> Univ(N,0);
vector<int> ans;
for(int i=10;i>=0;i--){
if(!mp.count(i)) continue;
if(mp[i].size()==1){
auto itr = mp[i].begin();
int pe = (*itr).first;
int un = (*itr).second;
ans.push_back(dic[make_tuple(i,pe)]);
Univ[un]++;
mp[i].erase(pii(pe,un));
}
if(mp[i].size()>1){
vector<pii> univs;
for(auto key : mp[i]) univs.push_back(pii(Univ[key.second],key.first));
sort(ALL(univs));
ans.push_back(dic[make_tuple(i,univs[0].second)]);
mp[i].erase(pii(univs[0].second,dicu[pii(i,univs[0].second)]));
i++;
}
if(ans.size()==K) break;
}
for(int i=0;i<K;i++) cout << ans[i] << endl;
}
chakku