Submission #00081


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include<stdio.h>
long long int n,x[1000],p[1000];
int dfs1(int now);
int dfs2(int now);
int main(){
long long int i;
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld %lld",&x[i],&p[i]);
}
for(i=0;i<n;i++){
int ans=0;
if(i==0)ans=1;
if(i==n-1)ans=10;
if(i>0){
ans+=dfs1(i);
}
if(i<n-1){
ans+=dfs2(i)*10;
}
if(ans==0)printf("X");
if(ans==1)printf("L");
if(ans==10)printf("R");
if(ans==11)printf("O");
}
printf("\n");
return(0);
}
int dfs1(int now){
int i;
if(now==0)return(1);
for(i=0;i<now;i++){
if(x[now]-x[i]<=p[now]){
if(dfs1(i))return(1);
}
}
return(0);
}
int dfs2(int now){
int i;
if(now==n-1)return(1);
for(i=n-1;i>now;i--){
if(x[i]-x[now]<=p[now]){
if(dfs2(i))return(1);
}
}
return(0);
}

ステータス

項目 データ
問題 0004 - 想起「貪欲だった六番目」
ユーザー名 ei1620
投稿日時 2017-12-22 14:46:21
言語 C
状態 Wrong Answer
得点 0
ソースコード長 872 Byte
最大実行時間 27 ms
最大メモリ使用量 660 KB

セット

セット 得点 Cases
1 ALL 0 / 250 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 WA 19 ms 380 KB
1
Input02 WA 16 ms 292 KB
1
Input03 WA 18 ms 300 KB
1
Input04 WA 27 ms 464 KB
1
Input05 WA 15 ms 376 KB
1
Input06 WA 17 ms 416 KB
1
Input07 WA 18 ms 460 KB
1
Input08 WA 18 ms 624 KB
1
Input09 WA 21 ms 440 KB
1
Input10 WA 16 ms 356 KB
1
Input11 WA 17 ms 360 KB
1
Input12 WA 16 ms 404 KB
1
Input13 WA 16 ms 468 KB
1
Input14 WA 16 ms 476 KB
1
Input15 WA 16 ms 516 KB
1
Input16 WA 19 ms 432 KB
1
Input17 WA 17 ms 472 KB
1
Input18 WA 18 ms 516 KB
1
Input19 WA 16 ms 552 KB
1
Input20 WA 16 ms 588 KB
1
Input21 WA 18 ms 624 KB
1
Input22 WA 16 ms 568 KB
1
Input23 WA 22 ms 480 KB
1
Input24 WA 14 ms 492 KB
1
Input25 WA 17 ms 528 KB
1
Input26 WA 23 ms 572 KB
1
Input27 WA 26 ms 488 KB
1
Input28 WA 19 ms 660 KB
1
Input29 WA 14 ms 604 KB
1
Input30 WA 17 ms 508 KB
1