結果
問題 | No.1514 Squared Matching |
ユーザー | tails |
提出日時 | 2021-05-21 23:08:39 |
言語 | C (gcc 12.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 844 bytes |
コンパイル時間 | 1,109 ms |
コンパイル使用メモリ | 31,616 KB |
実行使用メモリ | 489,740 KB |
最終ジャッジ日時 | 2024-04-18 16:45:58 |
合計ジャッジ時間 | 48,667 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,702 ms
198,744 KB |
testcase_01 | TLE | - |
testcase_02 | AC | 1,713 ms
196,736 KB |
testcase_03 | AC | 1,696 ms
196,736 KB |
testcase_04 | AC | 1,696 ms
196,736 KB |
testcase_05 | AC | 1,677 ms
196,736 KB |
testcase_06 | AC | 1,717 ms
201,088 KB |
testcase_07 | AC | 2,114 ms
252,544 KB |
testcase_08 | TLE | - |
testcase_09 | AC | 3,699 ms
443,648 KB |
testcase_10 | AC | 3,985 ms
464,128 KB |
testcase_11 | AC | 3,969 ms
475,392 KB |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
testcase_21 | TLE | - |
testcase_22 | AC | 2,914 ms
257,128 KB |
testcase_23 | AC | 2,677 ms
315,816 KB |
testcase_24 | AC | 3,197 ms
373,188 KB |
testcase_25 | AC | 3,795 ms
432,760 KB |
コンパイルメッセージ
main.c:26:1: warning: return type defaults to 'int' [-Wimplicit-int] 26 | main(){ | ^~~~ main.c: In function 'main': main.c:30:9: warning: implicit declaration of function 'read'; did you mean 'rd'? [-Wimplicit-function-declaration] 30 | read(0,rbuf,sizeof rbuf); | ^~~~ | rd main.c:54:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration] 54 | write(1,wp,wbuf+sizeof wbuf-wp); | ^~~~~ main.c:55:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration] 55 | _exit(0); | ^~~~~ | _Exit
ソースコード
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") char*mmap(); #define rd(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define wt_rev(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);} #define SIEVE_N 50000001 int sieve[SIEVE_N]; void mksieve(){ for(int i=2;i<SIEVE_N;++i){ if(sieve[i]==0){ for(int j=i;j<SIEVE_N;j+=i){ if(sieve[j]==0){ sieve[j]=i; } } } } } int cac[50000001]; short count[50000001]; main(){ mksieve(); char rbuf[64],*rp=rbuf; read(0,rbuf,sizeof rbuf); rd(n); int res=0; for(int i=1;i<=n;++i){ int j=i; int l=1; while(j>1){ int p=sieve[j]; j/=p; if(sieve[j]==p){ l*=cac[j/p]; break; } l*=p; } cac[i]=l; count[l]+=1; res+=count[l]*2-1; } char wbuf[64],*wp=wbuf+sizeof wbuf; wt_rev(res); write(1,wp,wbuf+sizeof wbuf-wp); _exit(0); }