結果
| 問題 | No.318 学学学学学 |
| コンテスト | |
| ユーザー |
tempura_pp
|
| 提出日時 | 2018-07-18 15:50:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 2,000 ms |
| コード長 | 771 bytes |
| 記録 | |
| コンパイル時間 | 884 ms |
| コンパイル使用メモリ | 96,648 KB |
| 実行使用メモリ | 8,996 KB |
| 最終ジャッジ日時 | 2024-06-22 18:36:41 |
| 合計ジャッジ時間 | 3,579 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:30:13: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
30 | scanf("%d",&a[i]);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;
int main(){
int n;
cin>>n;
int a[n];
map<int,int>mp;
rep(i,n){
scanf("%d",&a[i]);
mp[a[i]]=i;
}
priority_queue<int> q;
rep(i,n){
q.push(a[i]);
while(mp[q.top()]<i)q.pop();
printf("%d ",q.top());
}
return 0;
}
tempura_pp