Submission #18915


Source Code Expand

Copy
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

unsigned myrand(){
  static unsigned x=123456789, y=362436069, z=521288629, w=88675121;
  unsigned t;
  t = (x^(x<<11));
  x=y; y=z; z=w;
  w = (w^(w>>19))^(t^(t>>8));
  return w;
}

int main(){
  int i,j,k,l,m,n,loop;
  int now[12];
  int lis[20][20];
  double ok, dame;

  scanf("%d%d%d",&n,&m,&k);
  rep(i,n) rep(j,n) lis[i][j] = 0;
  while(m--){
    scanf("%d%d",&i,&j);
    lis[i][j] = lis[j][i] = 1;
  }

  ok = dame = 0;
  rep(loop,16000000){
    rep(i,n) now[i] = i;
    rep(l,k){
      i = myrand() % n;
      j = myrand() % (n-1);
      if(j >= i) j++;
      m = now[i]; now[i] = now[j]; now[j] = m;
    }
    m = 0;
    rep(i,n-1) m += lis[now[i]][now[i+1]];
    m += lis[now[n-1]][now[0]];
    if(m) dame += 1; else ok += 1;
  }

  printf("%.10f\n",ok/(ok+dame));

  return 0;
}

Submission Info

Submission Time
Task D - シャッフル席替え
User LayCurse
Language C (GCC 4.4.7)
Score 100
Code Size 977 Byte
Status AC
Exec Time 8883 ms
Memory 816 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:23: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
./Main.c:26: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 71
Set Name Test Cases
all 00_mini_01.txt, 00_mini_02.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_rnd_11_01.txt, 01_rnd_11_02.txt, 01_rnd_11_03.txt, 01_rnd_11_04.txt, 01_rnd_11_05.txt, 01_rnd_11_06.txt, 01_rnd_11_07.txt, 01_rnd_11_08.txt, 01_rnd_11_09.txt, 01_rnd_11_10.txt, 01_rnd_11_11.txt, 01_rnd_11_12.txt, 01_rnd_11_13.txt, 01_rnd_11_14.txt, 01_rnd_11_15.txt, 01_rnd_11_16.txt, 01_rnd_11_17.txt, 01_rnd_11_18.txt, 01_rnd_11_19.txt, 01_rnd_11_20.txt, 01_rnd_11_21.txt, 01_rnd_11_22.txt, 01_rnd_7_01.txt, 01_rnd_7_02.txt, 01_rnd_7_03.txt, 01_rnd_7_04.txt, 01_rnd_7_05.txt, 01_rnd_7_06.txt, 01_rnd_7_07.txt, 01_rnd_7_08.txt, 01_rnd_7_09.txt, 01_rnd_7_10.txt, 01_rnd_7_11.txt, 01_rnd_7_12.txt, 01_rnd_7_13.txt, 01_rnd_7_14.txt, 01_rnd_7_15.txt, 01_rnd_7_16.txt, 01_rnd_7_17.txt, 01_rnd_7_18.txt, 01_rnd_7_19.txt, 01_rnd_7_20.txt, 01_rnd_7_21.txt, 01_rnd_7_22.txt, 01_rnd_8_01.txt, 01_rnd_8_02.txt, 01_rnd_8_03.txt, 01_rnd_8_04.txt, 01_rnd_8_05.txt, 01_rnd_8_06.txt, 01_rnd_8_07.txt, 01_rnd_8_08.txt, 01_rnd_8_09.txt, 01_rnd_8_10.txt, 01_rnd_8_11.txt, 01_rnd_8_12.txt, 01_rnd_8_13.txt, 01_rnd_8_14.txt, 01_rnd_8_15.txt, 01_rnd_8_16.txt, 01_rnd_8_17.txt, 01_rnd_8_18.txt, 01_rnd_8_19.txt, 01_rnd_8_20.txt, 01_rnd_8_21.txt, 01_rnd_8_22.txt
Case Name Status Exec Time Memory
00_mini_01.txt AC 7726 ms 652 KB
00_mini_02.txt AC 7729 ms 660 KB
00_sample_01.txt AC 797 ms 660 KB
00_sample_02.txt AC 8533 ms 664 KB
00_sample_03.txt AC 1247 ms 664 KB
01_rnd_11_01.txt AC 8776 ms 732 KB
01_rnd_11_02.txt AC 8827 ms 656 KB
01_rnd_11_03.txt AC 8863 ms 660 KB
01_rnd_11_04.txt AC 8883 ms 656 KB
01_rnd_11_05.txt AC 8870 ms 812 KB
01_rnd_11_06.txt AC 8852 ms 816 KB
01_rnd_11_07.txt AC 8863 ms 724 KB
01_rnd_11_08.txt AC 8857 ms 660 KB
01_rnd_11_09.txt AC 8816 ms 660 KB
01_rnd_11_10.txt AC 8792 ms 660 KB
01_rnd_11_11.txt AC 8799 ms 652 KB
01_rnd_11_12.txt AC 7544 ms 684 KB
01_rnd_11_13.txt AC 519 ms 660 KB
01_rnd_11_14.txt AC 1471 ms 660 KB
01_rnd_11_15.txt AC 8483 ms 736 KB
01_rnd_11_16.txt AC 5246 ms 728 KB
01_rnd_11_17.txt AC 3124 ms 660 KB
01_rnd_11_18.txt AC 5997 ms 664 KB
01_rnd_11_19.txt AC 8024 ms 664 KB
01_rnd_11_20.txt AC 8000 ms 664 KB
01_rnd_11_21.txt AC 5146 ms 664 KB
01_rnd_11_22.txt AC 3039 ms 656 KB
01_rnd_7_01.txt AC 8618 ms 688 KB
01_rnd_7_02.txt AC 8726 ms 668 KB
01_rnd_7_03.txt AC 8766 ms 728 KB
01_rnd_7_04.txt AC 8711 ms 660 KB
01_rnd_7_05.txt AC 8664 ms 656 KB
01_rnd_7_06.txt AC 8658 ms 640 KB
01_rnd_7_07.txt AC 8640 ms 656 KB
01_rnd_7_08.txt AC 8625 ms 660 KB
01_rnd_7_09.txt AC 8621 ms 660 KB
01_rnd_7_10.txt AC 8632 ms 728 KB
01_rnd_7_11.txt AC 8622 ms 656 KB
01_rnd_7_12.txt AC 4952 ms 664 KB
01_rnd_7_13.txt AC 8306 ms 664 KB
01_rnd_7_14.txt AC 5473 ms 736 KB
01_rnd_7_15.txt AC 4637 ms 660 KB
01_rnd_7_16.txt AC 7870 ms 660 KB
01_rnd_7_17.txt AC 3354 ms 660 KB
01_rnd_7_18.txt AC 4976 ms 656 KB
01_rnd_7_19.txt AC 2042 ms 668 KB
01_rnd_7_20.txt AC 2875 ms 720 KB
01_rnd_7_21.txt AC 4950 ms 664 KB
01_rnd_7_22.txt AC 1615 ms 664 KB
01_rnd_8_01.txt AC 8651 ms 664 KB
01_rnd_8_02.txt AC 8727 ms 664 KB
01_rnd_8_03.txt AC 8758 ms 660 KB
01_rnd_8_04.txt AC 8735 ms 664 KB
01_rnd_8_05.txt AC 8711 ms 660 KB
01_rnd_8_06.txt AC 8705 ms 724 KB
01_rnd_8_07.txt AC 8686 ms 640 KB
01_rnd_8_08.txt AC 8692 ms 732 KB
01_rnd_8_09.txt AC 8647 ms 664 KB
01_rnd_8_10.txt AC 8659 ms 660 KB
01_rnd_8_11.txt AC 8636 ms 660 KB
01_rnd_8_12.txt AC 5793 ms 664 KB
01_rnd_8_13.txt AC 950 ms 660 KB
01_rnd_8_14.txt AC 5916 ms 656 KB
01_rnd_8_15.txt AC 4276 ms 724 KB
01_rnd_8_16.txt AC 3428 ms 668 KB
01_rnd_8_17.txt AC 7872 ms 656 KB
01_rnd_8_18.txt AC 1675 ms 672 KB
01_rnd_8_19.txt AC 4200 ms 660 KB
01_rnd_8_20.txt AC 5818 ms 660 KB
01_rnd_8_21.txt AC 1654 ms 656 KB
01_rnd_8_22.txt AC 7844 ms 668 KB