結果
| 問題 |
No.759 悪くない忘年会にしような!
|
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2018-12-07 02:06:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,257 bytes |
| コンパイル時間 | 858 ms |
| コンパイル使用メモリ | 89,796 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-14 03:09:52 |
| 合計ジャッジ時間 | 4,860 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 12 WA * 52 |
ソースコード
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<P, P> PP;
const int MAX_N=1<<14;
int m, mx[2*MAX_N-1];
void init(int m_){
m=1;
while(m<m_) m*=2;
for(int i=1; i<=2*m-1; i++) mx[i]=-1;
}
void update(int k, int a){
k+=m;
mx[k]=max(mx[k], a);
while(k>1){
k>>=1;
mx[k]=max(mx[2*k], mx[2*k+1]);
}
}
int query(int a, int b){
a+=m, b+=m;
int ans=-1;
for(;a<b; a>>=1, b>>=1){
if(b&1){
b--;
ans=max(ans, mx[b]);
}
if(a&1){
ans=max(ans, mx[a]);
a++;
}
}
return ans;
}
int main()
{
int n;
cin>>n;
PP ptr[100000];
for(int i=0; i<n; i++){
int p, t, r; cin>>p>>t>>r;
ptr[i]=PP(P(p, t), P(r, i));
}
sort(ptr, ptr+n, greater<PP>());
bool nuee[100000]={};
init(10001);
for(int i=0; i<n; i++){
int p=ptr[i].first.first, t=ptr[i].first.second, r=ptr[i].second.first, j=ptr[i].second.second;
if(query(t, 10001)>=r) nuee[j]=1;
update(t, r);
}
for(int i=0; i<n; i++){
if(!nuee[i]) printf("%d\n", i+1);
}
return 0;
}
chocorusk