結果

問題 No.326 あみだますたー
コンテスト
ユーザー testestest
提出日時 2017-11-06 09:24:40
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 376 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 67 ms
コンパイル使用メモリ 25,812 KB
最終ジャッジ日時 2026-02-22 00:29:53
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
main.c:1:8: error: type defaults to 'int' in declaration of 'g' [-Wimplicit-int]
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      |        ^
main.c:1:15: error: type defaults to 'int' in declaration of 'ans' [-Wimplicit-int]
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      |               ^~~
main.c:1:25: warning: data definition has no type or storage class
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      |                         ^
main.c:1:25: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
main.c:1:27: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      |                           ^
main.c:1:29: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      |                             ^
main.c:1:31: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      |                               ^
main.c:1:33: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      |                                 ^
main.c:1:35: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      |                                   ^
main.c:1:37: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      |                                     ^
main.c:1:39: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
    1 | d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
      |                                       ^
main.c:2:1: error: return type defaults to 'i

ソースコード

diff #
raw source code

d[110],g[110],ans[6000];c,i,j,n,k,t,a,b;
main(){
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++)d[i]=i;
	while(k--){
		scanf("%d%d",&a,&b);
		d[a]^=d[b]^=d[a]^=d[b];
	}
	for(i=1;i<=n;i++)scanf("%d",g+i);
	for(i=1;i<=n;i++)for(j=1;j<=n-i;j++)if(g[d[j]]>g[d[j+1]]){
		ans[c++]=j;
		d[j]^=d[j+1]^=d[j]^=d[j+1];
	}
	printf("%d\n",c);
	for(i=0;i<c;i++)printf("%d %d\n",ans[i],ans[i]+1);
}
0