結果
問題 | No.318 学学学学学 |
ユーザー | CleyL |
提出日時 | 2021-12-11 14:37:55 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 176 ms / 2,000 ms |
コード長 | 915 bytes |
コンパイル時間 | 864 ms |
コンパイル使用メモリ | 88,700 KB |
実行使用メモリ | 15,840 KB |
最終ジャッジ日時 | 2023-09-27 02:06:57 |
合計ジャッジ時間 | 6,415 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 11 ms
4,376 KB |
testcase_01 | AC | 22 ms
5,444 KB |
testcase_02 | AC | 28 ms
5,964 KB |
testcase_03 | AC | 18 ms
5,120 KB |
testcase_04 | AC | 23 ms
5,880 KB |
testcase_05 | AC | 176 ms
15,840 KB |
testcase_06 | AC | 129 ms
12,288 KB |
testcase_07 | AC | 111 ms
10,488 KB |
testcase_08 | AC | 94 ms
8,684 KB |
testcase_09 | AC | 78 ms
7,336 KB |
testcase_10 | AC | 64 ms
6,004 KB |
testcase_11 | AC | 174 ms
15,788 KB |
testcase_12 | AC | 113 ms
11,216 KB |
testcase_13 | AC | 92 ms
9,336 KB |
testcase_14 | AC | 74 ms
7,992 KB |
testcase_15 | AC | 63 ms
6,996 KB |
testcase_16 | AC | 53 ms
5,940 KB |
testcase_17 | AC | 88 ms
12,388 KB |
testcase_18 | AC | 84 ms
12,332 KB |
testcase_19 | AC | 85 ms
12,600 KB |
testcase_20 | AC | 35 ms
5,944 KB |
testcase_21 | AC | 2 ms
4,376 KB |
testcase_22 | AC | 2 ms
4,380 KB |
testcase_23 | AC | 2 ms
4,376 KB |
testcase_24 | AC | 1 ms
4,376 KB |
testcase_25 | AC | 2 ms
4,380 KB |
testcase_26 | AC | 1 ms
4,380 KB |
testcase_27 | AC | 1 ms
4,380 KB |
testcase_28 | AC | 1 ms
4,380 KB |
ソースコード
#include <iostream> #include <queue> #include <vector> #include <map> using namespace std; int main(){ int n;cin>>n; map<int,pair<int,int>> A; for(int i = 0; n > i; i++){ int t;cin>>t; if(!A[t].first){ A[t].first = i+1; } A[t].second = i+1; } vector<int> ret[n+1],ans(n); for(auto x: A){ ret[x.second.first-1].push_back(x.first); ret[x.second.second].push_back(-x.first); } priority_queue<int> C; priority_queue<int> eraser; for(int i = 0; n > i; i++){ for(int j = 0; ret[i].size() > j; j++){ if(ret[i][j]>0){ C.push(ret[i][j]); }else if(ret[i][j] < 0){ eraser.push(-1*ret[i][j]); } } while(C.size() && eraser.size() && C.top() == eraser.top()){ C.pop(); eraser.pop(); } ans[i] = C.top(); } for(int i = 0; n > i; i++){ cout << ans[i]; if(i+1 != n)cout << " "; } cout << endl; }