結果
| 問題 |
No.318 学学学学学
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-11 06:52:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1,735 ms / 2,000 ms |
| コード長 | 401 bytes |
| コンパイル時間 | 664 ms |
| コンパイル使用メモリ | 51,072 KB |
| 実行使用メモリ | 9,600 KB |
| 最終ジャッジ日時 | 2024-06-22 15:17:33 |
| 合計ジャッジ時間 | 9,928 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:11:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d",&x);
| ~~~~~^~~~~~~~~
ソースコード
#include <vector>
#include <map>
#include <cstdio>
using namespace std;
int main(){
int N;
map<int,pair<int,int> >m;
scanf("%d",&N);
for(int i=0,x;i<N;i++){
scanf("%d",&x);
if(m.find(x)==m.end())m[x]=make_pair(i,i);
else m[x].second=i;
}
vector<int> v(N);
for(auto &e:m)for(int i=e.second.first;i<=e.second.second;i++)v[i]=e.first;
for(int i=0;i<N;i++)printf(i<N-1?"%d ":"%d\n",v[i]);
}