結果
| 問題 | No.390 最長の数列 |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2020-10-22 20:01:50 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 464 bytes |
| 記録 | |
| コンパイル時間 | 87 ms |
| コンパイル使用メモリ | 28,192 KB |
| 最終ジャッジ日時 | 2026-02-22 06:14:26 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c:8:1: error: return type defaults to 'int' [-Wimplicit-int]
8 | main(){
| ^~~~
main.c: In function 'main':
main.c:9:9: error: implicit declaration of function 'read' [-Wimplicit-function-declaration]
9 | read(0,rbuf,sizeof rbuf);
| ^~~~
main.c:30:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
30 | printf("%d",z+e[1]);
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | #pragma GCC optimize("Ofast")
main.c:30:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
30 | printf("%d",z+e[1]);
| ^~~~~~
main.c:30:9: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
char rbuf[800000];
char e[1000001];
char t[1000001];
main(){
read(0,rbuf,sizeof rbuf);
char*r=rbuf;
int c;
int n=0;
while(c=*r++-48,c>=0)n=10*n+c;
while(n--){
int x=0;
while(c=*r++-48,c>=0)x=10*x+c;
e[x]=1;
}
int z=0;
for(int x=2;x<=1000000;++x){
if(e[x]){
int tx=t[x]+1;
if(z<tx) z=tx;
for(int y=x;(y+=x)<=1000000;){
if(t[y]<tx) t[y]=tx;
}
}
}
printf("%d",z+e[1]);
}
tails