結果
| 問題 | No.927 Second Permutation |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2020-10-16 16:11:21 |
| 言語 | C90(gcc15) (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 386 bytes |
| 記録 | |
| コンパイル時間 | 83 ms |
| コンパイル使用メモリ | 26,164 KB |
| 最終ジャッジ日時 | 2026-02-24 01:05:22 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'main':
main.c:9:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
9 | for(char*p=s;*p!=10;++p){
| ^~~
main.c:9:9: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
main.c:12:14: error: redefinition of 'p'
12 | char*p=s,*q;
| ^
main.c:9:18: note: previous definition of 'p' with type 'char *'
9 | for(char*p=s;*p!=10;++p){
| ^
main.c:13:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
13 | for(int j=58;--j>=48;){
| ^~~
main.c:16:25: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
16 | memset(q=p,j,k);
| ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset'
+++ |+#include <string.h>
1 | #pragma GCC optimize("Ofast")
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char s[100004];
int h[64];
main(){
int n;
n=read(0,s,100001);
for(char*p=s;*p!=10;++p){
++h[*p];
}
char*p=s,*q;
for(int j=58;--j>=48;){
int k=h[j];
if(k){
memset(q=p,j,k);
p+=k;
}
}
if(q==s || q==s+1 && *q==48){
write(1,"-1",2);
}else{
int t=*q;
*q=q[-1];
q[-1]=t;
write(1,s,n);
}
_exit(0);
}
tails