結果
問題 |
No.759 悪くない忘年会にしような!
|
ユーザー |
![]() |
提出日時 | 2018-12-22 21:19:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,933 bytes |
コンパイル時間 | 1,826 ms |
コンパイル使用メモリ | 180,140 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-25 10:16:17 |
合計ジャッジ時間 | 7,606 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 WA * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) #define unless(p) if(!(p)) #define until(p) while(!(p)) using ll = long long; using P = std::tuple<int,int>; const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1}; int N; std::vector<int> A[3]; bool checked[100100]; void f(int x, int y, int z){ std::vector<int> indices(N); std::iota(indices.begin(), indices.end(), 0); std::sort(indices.begin(), indices.end(), [&](int i, int j){return A[x][i] < A[x][j];}); std::reverse(indices.begin(), indices.end()); std::map<int, int> rects; for(int i=0,j=0;i<N;i=j){ while(j < N && A[x][indices[j]] == A[x][indices[i]]){ j += 1; } for(int k=i;k<j;++k){ int t = A[y][indices[k]], u = A[z][indices[k]]; auto it = rects.lower_bound(t); if(it == rects.end() || it->second < u){ continue; } checked[indices[k]] = 1; } for(int k=i;k<j;++k){ int t = A[y][indices[k]], u = A[z][indices[k]]; auto it = rects.lower_bound(t); while(it != rects.begin() && prev(it)->second <= u){ auto p = prev(it); if(p != rects.begin()){ it = prev(p); } rects.erase(p); } rects[t] = u; } } } int main(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cin >> N; for(int i=0;i<3;++i){ A[i].resize(N); } for(int i=0;i<N;++i){ std::cin >> A[0][i] >> A[1][i] >> A[2][i]; } f(0, 1, 2); f(1, 2, 0); f(2, 0, 1); for(int i=0;i<N;++i){ if(!checked[i]){ std::cout << (i + 1) << std::endl; } } }