結果
| 問題 |
No.2449 square_permutation
|
| ユーザー |
tails
|
| 提出日時 | 2023-08-31 22:01:05 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 803 bytes |
| コンパイル時間 | 1,945 ms |
| コンパイル使用メモリ | 26,624 KB |
| 最終ジャッジ日時 | 2025-01-03 04:55:51 |
| 合計ジャッジ時間 | 2,659 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'f1':
main.c:19:14: error: expected ';' before 'i'
19 | rep3(i,1,n+1){
| ^
main.c:8:35: note: in definition of macro 'rep3'
8 | #define rep3(v,s,e) for(typeof(e) v=s;v<e;++v)
| ^
main.c:19:14: error: 'i' undeclared (first use in this function)
19 | rep3(i,1,n+1){
| ^
main.c:8:39: note: in definition of macro 'rep3'
8 | #define rep3(v,s,e) for(typeof(e) v=s;v<e;++v)
| ^
main.c:19:14: note: each undeclared identifier is reported only once for each function it appears in
19 | rep3(i,1,n+1){
| ^
main.c:8:39: note: in definition of macro 'rep3'
8 | #define rep3(v,s,e) for(typeof(e) v=s;v<e;++v)
| ^
main.c:22:25: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
22 | for(int j=0,k;++j,k=j*j*i,k<=n;){
| ^~~
main.c:22:25: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
main.c:25:29: error: expected ';' before 'j'
25 | rep(j,m){
| ^
main.c:7:32: note: in definition of macro 'rep'
7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c: In function 'f2':
main.c:35:15: error: expected ';' before 'i'
35 | rrep3(i,1,n+1){
| ^
main.c:9:36: note: in definition of macro 'rrep3'
9 | #define rrep3(v,s,e) for(typeof(e) v=e;--v>=s;)
| ^
main.c:35:15: error: 'i' undeclared (first use in this function)
35 | rrep3(i,1,n+1){
| ^
main.c:9:42: note: in definition of macro 'rrep3'
9 | #define rrep3(v,s,e) for(typeof(e) v=e;--v>=s;)
| ^
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) ({unsigned _z=v;do*--wp=_z%10+48;while(_z/=10);})
#define rep(v,e) for(typeof(e) v=0;v<e;++v)
#define rep3(v,s,e) for(typeof(e) v=s;v<e;++v)
#define rrep3(v,s,e) for(typeof(e) v=e;--v>=s;)
int a[300001];
int c[300001];
char wbuf[1<<25];
int f1(){
rd_init();
int n=rd();
rep3(i,1,n+1){
if(!a[i]){
int m=0;
for(int j=0,k;++j,k=j*j*i,k<=n;){
c[m++]=k;
}
rep(j,m){
a[c[j]]=c[m+~j];
}
}
}
return n;
}
void f2(int n){
char*wp=wbuf+sizeof wbuf;
rrep3(i,1,n+1){
*--wp=' ';
wt(a[i]);
}
write(1,wp,wbuf+sizeof wbuf-wp);
}
int main(){
f2(f1());
_exit(0);
}
tails