Submission #00083


ソースコード

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:52:04
言語 C
状態 Wrong Answer
得点 0
ソースコード長 872 Byte
最大実行時間 25 ms
最大メモリ使用量 724 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 WA 21 ms 380 KB
1
Input02 WA 21 ms 296 KB
1
Input03 WA 19 ms 296 KB
1
Input04 WA 17 ms 336 KB
1
Input05 WA 15 ms 380 KB
1
Input06 WA 22 ms 412 KB
1
Input07 WA 23 ms 456 KB
1
Input08 WA 14 ms 496 KB
1
Input09 WA 14 ms 540 KB
1
Input10 WA 16 ms 580 KB
1
Input11 WA 14 ms 392 KB
1
Input12 WA 19 ms 404 KB
1
Input13 WA 15 ms 444 KB
1
Input14 WA 16 ms 488 KB
1
Input15 WA 13 ms 532 KB
1
Input16 WA 20 ms 576 KB
1
Input17 WA 14 ms 488 KB
1
Input18 WA 14 ms 532 KB
1
Input19 WA 14 ms 568 KB
1
Input20 WA 23 ms 608 KB
1
Input21 WA 16 ms 424 KB
1
Input22 WA 25 ms 436 KB
1
Input23 WA 15 ms 508 KB
1
Input24 WA 13 ms 524 KB
1
Input25 WA 17 ms 568 KB
1
Input26 WA 16 ms 476 KB
1
Input27 WA 13 ms 644 KB
1
Input28 WA 16 ms 680 KB
1
Input29 WA 12 ms 724 KB
1
Input30 WA 19 ms 664 KB
1