Submission #616533


Source Code Expand

#include <cstdio>
#include <vector>
#include <cstring>
#include <functional>
#include <algorithm>
#include <math.h>
#include <bitset>
#include <set>
#include <queue>
#include <assert.h>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <complex>
#include <numeric>
#include <map>
#include <time.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<int,ull> piu;
typedef pair<ull,ull> puu;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
typedef pair<pii,ll> ppl;
typedef pair<ll,pii> plp;
typedef pair<ll,pll> plP;
typedef pair<int,pii> pip;
typedef pair<pii,int> ppi;
typedef pair<pii,pii> ppp;
typedef pair<double,int> pdi;
typedef pair<int,double> pid;
typedef pair<double,pii> pdp;
typedef pair<double,double> pdd;
typedef pair<pdd,double> pd3;
typedef vector<double> vec;
typedef vector<vec> mat;
#define rep(i,n) for (int (i) = 0; (i) < (n); (i)++)
#define repn(i,a,n) for (int (i) = (a); (i) < (n); (i)++)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define SORT(x) sort((x).begin(),(x).end())
#define SORTN(x,n) sort((x),(x)+(n))
#define ERASE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define COUNT(x,c) count((x).begin(),(x).end(),(c))
#define REMOVE(x,c) (x).erase(remove((x).begin(),(x).end(),(c)),(x).end())
#define REVERSE(x) reverse((x).begin(),(x).end())
#define FORIT(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))-(x).begin()
#define lb(x,a) lower_bound((x).begin(),(x).end(),(a))
#define LBN(x,a,n) lower_bound((x),(x)+(n),(a))-(x)
#define lbN(x,a,n) lower_bound((x),(x)+(n),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))-(x).begin()
#define ub(x,a) upper_bound((x).begin(),(x).end(),(a))
#define BS(x,a) binary_search((x).begin(),(x).end(),(a))
#define BS2(x,n,a) binary_search((x),(x)+(n),(a))
#define NB(x) (((x)&~((x)+((x)&-(x))))/((x)&-(x))>>1)|((x)+((x)&-(x)))
#define NP(x) next_permutation((x).begin(),(x).end())
#define MM(x,p) memset((x),(p),sizeof(x))
#define SQ(x) (x)*(x)
#define SC(c1,c2) strcmp(c1,c2)==0
#define mp make_pair
#define INF (1<<28)
#define INFL (1LL<<61)
#define fi first
#define se second
#define EPS 1e-9
#define MOD 1000000007
#define MIN(x,a) x=min(x,a)
#define MAX(x,a) x=max(x,a)
#define madd(x,a) x=(x+a)%MOD
#define msub(x,a) x=(x+MOD-a)%MOD
#define OUTPUT(x) rep(__,x.size())printf("%d%c",x[__],__+1==x.size()?'\n':' ');

int N;
int K[114514];

int res[114514];

int main()
{
	scanf("%d",&N);N--;
	rep(i,N)scanf("%d",&K[i]);
	vector<pii> v;
	rep(i,N)v.pb(mp(K[i],i));
	SORT(v);
	rep(i,114514)res[i]=1<<30;
	rep(i,N)
	{
		int p1=v[i].fi,p2=v[i].se;
		MIN(res[p2],p1);
		MIN(res[p2+1],p1);
	}
	rep(i,N+1)printf("%d%c",res[i],i==N?'\n':' ');
}

Submission Info

Submission Time
Task B - 積み鉛筆
User namonakiacc
Language C++ (GCC 4.9.2)
Score 80
Code Size 2988 Byte
Status AC
Exec Time 85 ms
Memory 2460 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:87:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&N);N--;
                ^
./Main.cpp:88:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  rep(i,N)scanf("%d",&K[i]);
                           ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 80 / 80
Status
AC × 3
AC × 15
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All subtask0_0.txt, subtask0_1.txt, subtask0_10.txt, subtask0_11.txt, subtask0_12.txt, subtask0_13.txt, subtask0_14.txt, subtask0_2.txt, subtask0_3.txt, subtask0_4.txt, subtask0_5.txt, subtask0_6.txt, subtask0_7.txt, subtask0_8.txt, subtask0_9.txt
Case Name Status Exec Time Memory
sample1.txt AC 26 ms 1308 KB
sample2.txt AC 27 ms 1300 KB
sample3.txt AC 28 ms 1188 KB
subtask0_0.txt AC 80 ms 2320 KB
subtask0_1.txt AC 71 ms 2452 KB
subtask0_10.txt AC 65 ms 2328 KB
subtask0_11.txt AC 72 ms 2452 KB
subtask0_12.txt AC 79 ms 2324 KB
subtask0_13.txt AC 69 ms 2460 KB
subtask0_14.txt AC 73 ms 2460 KB
subtask0_2.txt AC 64 ms 2328 KB
subtask0_3.txt AC 75 ms 2328 KB
subtask0_4.txt AC 69 ms 2452 KB
subtask0_5.txt AC 65 ms 2324 KB
subtask0_6.txt AC 74 ms 2328 KB
subtask0_7.txt AC 63 ms 2200 KB
subtask0_8.txt AC 71 ms 2456 KB
subtask0_9.txt AC 85 ms 2452 KB