Submission #00051


ソースコード

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include<stdio.h>
int main(){
int a,b=-1000000002,d=-1,e,nr,nl,ne,sha,gg=0,p,pp,jc;
scanf("%d",&a);
int q[a][2];
for (int o=0; o<a; o++){
q[o][1]=0;
q[o][0]=-1000000002;
}
for (int o=-1; o<a-1; o++){
scanf("%d",&b);
if(q[d][0]==b){
q[d][1]++;
}else{
d++;
q[d][0]=b;
q[d][1]++;
}
// printf("fe%d hi%d\n",q[3][1],d);
}
scanf("%d",&jc);
// printf("%d %d %d\n",q[0][1],q[1][1],q[2][1]);
for (int o=0; o<jc; o++){
scanf("%d",&p);
nr=d-1;
nl=0;
sha=0;
gg=0;
pp=0;
if(q[d][0]<p){
printf("0\n");
gg++;
sha=1;
}
if(q[0][0]>p){
printf("0\n");
sha=1;
gg++;
}
if(q[d][0]==p){
sha=1;
printf("%d\n",q[d][1]);
gg++;
}
if(q[0][0]==p){
sha=1;
printf("%d\n",q[0][1]);
gg++;
}
// printf("ji\n");
while(sha==0){
e=nr+nl;
e=e/2;
if(q[e][0]>p){
nr=e;
}else{
nl=e;
}
if(pp==0&&q[e][0]==p){
sha=1;
pp=1;
}
if(pp==0&&q[e-1][0]==p){
sha=1;
pp=1;
e--;
}
if(pp==0&&q[e+1][0]==p){
sha=1;
pp=1;
e++;
}
if(q[e][0]>p&&q[e-1][0]<p){
sha=1;
gg++;
pp++;
printf("0\n");
}
if(q[e][0]<p&&q[e+1][0]>p){
sha=1;
gg++;
pp++;
printf("0\n");
}
}
if(gg==0){
printf("%d\n",q[e][1]);
}
}
return(0);
}

ステータス

項目 データ
問題 0011 - Number-Collection
ユーザー名 SnakyZoo8277089
投稿日時 2024-05-30 16:42:21
言語 C
状態 Time Limit Exceeded
得点 1.5
ソースコード長 2071 Byte
最大実行時間 500 ms
最大メモリ使用量 30608 KB

セット

セット 得点 Cases
1 a_NQ-small 0 / 1.5 *E??
2 b_a-small-positive 1.5 / 1.5 *?E?
3 c_a-unique 0 / 4.5 *??E
4 d_ALL 0 / 7.5 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input-sample1EEE AC 21 ms 376 KB
1
2
3
4
input-sample2E__ AC 19 ms 400 KB
1
4
input01EEE AC 20 ms 324 KB
1
2
3
4
input02EEE AC 15 ms 528 KB
1
2
3
4
input03E__ TLE 500 ms 460 KB
1
4
input04E__ AC 20 ms 476 KB
1
4
input05E__ AC 20 ms 528 KB
1
4
input06_E_ AC 100 ms 6208 KB
2
4
input07_E_ AC 146 ms 14452 KB
2
4
input08_E_ AC 180 ms 20480 KB
2
4
input09__E TLE 500 ms 22568 KB
3
4
input10__E TLE 500 ms 8816 KB
3
4
input11__E AC 238 ms 25516 KB
3
4
input12___ AC 77 ms 7584 KB
4
input13___ AC 95 ms 10384 KB
4
input14___ AC 102 ms 13864 KB
4
input15___ AC 245 ms 29364 KB
4
input16___ WA 260 ms 30180 KB
4
input17___ AC 250 ms 30608 KB
4
input18 WA 35 ms 7488 KB
4