結果
| 問題 |
No.318 学学学学学
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2015-12-11 19:11:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,817 bytes |
| コンパイル時間 | 1,182 ms |
| コンパイル使用メモリ | 109,696 KB |
| 実行使用メモリ | 6,784 KB |
| 最終ジャッジ日時 | 2024-09-15 08:15:43 |
| 合計ジャッジ時間 | 3,346 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 26 |
コンパイルメッセージ
In file included from /usr/include/c++/11/bits/char_traits.h:39,
from /usr/include/c++/11/ios:40,
from /usr/include/c++/11/ostream:38,
from /usr/include/c++/11/iostream:39,
from main.cpp:3:
In static member function ‘static _Tp* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(const _Tp*, const _Tp*, _Tp*) [with _Tp = int; bool _IsMove = false]’,
inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = int*; _OI = int*]’ at /usr/include/c++/11/bits/stl_algobase.h:495:30,
inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = int*; _OI = int*]’ at /usr/include/c++/11/bits/stl_algobase.h:522:42,
inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = int*; _OI = int*]’ at /usr/include/c++/11/bits/stl_algobase.h:529:31,
inlined from ‘_OI std::copy(_II, _II, _OI) [with _II = int*; _OI = int*]’ at /usr/include/c++/11/bits/stl_algobase.h:620:7,
inlined from ‘static _ForwardIterator std::__uninitialized_copy<true>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = int*; _ForwardIterator = int*]’ at /usr/include/c++/11/bits/stl_uninitialized.h:110:27,
inlined from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = int*; _ForwardIterator = int*]’ at /usr/include/c++/11/bits/stl_uninitialized.h:151:15,
inlined from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = int*; _ForwardIterator = int*; _Tp = int]’ at /usr/include/c++/11/bits/stl_uninitialized.h:333:37,
inlined from ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]’ at /usr/include/c++/11/
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <vector>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>
#include <valarray>
#include<cassert>//assert();
//#include <random>//xAOJ
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PII pair<int,int>
/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
/////////
using namespace::std;
/////////
/////////
void solve(){
/*int N;
cin >> N;
vector<int> data(N);
for(int i=0;i<N;++i){
cin >> data[i];
}
*/
//
int N = 100000;
vector<int> data(N);
for(int i=0;i<N;++i){
data[i] = i%50000;
}
//
//最大10^5個の要素を得る
vector<int> uni(N);
uni = data;
sort( uni.begin(), uni.end() );
uni.erase( unique( uni.begin(),uni.end() ), uni.end() );
//uniに要素が昇順で一個ずつ入っている。
//
vector<int>::iterator it,endit,start;
it = uni.begin();
endit = uni.end();
vector< vector<int> > list( uni.size() );
int uSize = uni.size();
int temp;
int Pos;
for(int i=0;i<N;++i){
temp = data[i];
//tempがi番目にある。
it = lower_bound( uni.begin(), uni.end(), temp );
Pos = (it - uni.begin() );
list[Pos].push_back( i );
}
int sPos,ePos,ter;
ter = uni[uSize-1];
pair<int,int> pTemp,Atemp[2];
bool Aflag[2];
pTemp.first = 0;
pTemp.second = N-1;
vector< pair<int,int> > hani;
hani.push_back( pTemp );
vector< pair<int,int> >::iterator pIt,pEnd;
for(int i=uSize-1;i>=0; --i){
ter = uni[i];
sPos = *(list[i].begin());
ePos = *(list[i].end()-1);
pIt = hani.begin();
pEnd = hani.end();
while( sPos <= ePos && pIt != hani.end() ){
if( ePos < pIt->first ) break;
if( pIt->second < sPos ){
++pIt;
continue;
}
int A,B;
A = max( sPos,pIt->first );
B = min( ePos,pIt->second );
Aflag[0] = false;
Aflag[1] = false;
for(int j=A;j<=B;++j){
data[j] = ter;
}
if( pIt->first != A ){
Atemp[0].first = pIt->first;
Atemp[0].second = A-1;
Aflag[0] = true;
}
if( pIt->second != B ){
Atemp[1].first = B;
Atemp[1].second = pIt->second;
Aflag[1] = true;
}
sPos = pIt->second + 1;
hani.erase( pIt );
for(int j=0;j<2;++j){
if( Aflag[j] ){
hani.push_back( Atemp[j] );
}
}
sort( hani.begin(), hani.end() );
pIt = hani.begin();
}
}
//結果表示
for(int i=0;i<N;++i){
if( i != 0 ){
cout << " ";
}
cout << data[i];
}cout << endl;
}
int main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//
//cout << setprecision(16);//
//cpp
solve();
return 0;
}
IL_msta