Submission #18856


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 0
Code Size 977 Byte
Status WA
Exec Time 7281 ms
Memory 752 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 0 / 100
Status
AC × 55
WA × 16
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 3883 ms 732 KB
00_mini_02.txt AC 3894 ms 672 KB
00_sample_01.txt AC 663 ms 660 KB
00_sample_02.txt AC 6567 ms 736 KB
00_sample_03.txt WA 1008 ms 744 KB
01_rnd_11_01.txt AC 7184 ms 728 KB
01_rnd_11_02.txt AC 7221 ms 720 KB
01_rnd_11_03.txt AC 7255 ms 664 KB
01_rnd_11_04.txt AC 7281 ms 716 KB
01_rnd_11_05.txt AC 7278 ms 732 KB
01_rnd_11_06.txt AC 7261 ms 668 KB
01_rnd_11_07.txt AC 7240 ms 656 KB
01_rnd_11_08.txt AC 7229 ms 732 KB
01_rnd_11_09.txt AC 7217 ms 752 KB
01_rnd_11_10.txt AC 7207 ms 720 KB
01_rnd_11_11.txt AC 7208 ms 744 KB
01_rnd_11_12.txt AC 6208 ms 728 KB
01_rnd_11_13.txt AC 498 ms 656 KB
01_rnd_11_14.txt WA 1373 ms 736 KB
01_rnd_11_15.txt WA 6953 ms 728 KB
01_rnd_11_16.txt WA 4354 ms 660 KB
01_rnd_11_17.txt WA 2688 ms 728 KB
01_rnd_11_18.txt AC 4971 ms 664 KB
01_rnd_11_19.txt AC 6578 ms 732 KB
01_rnd_11_20.txt AC 6570 ms 664 KB
01_rnd_11_21.txt WA 4294 ms 736 KB
01_rnd_11_22.txt WA 2637 ms 720 KB
01_rnd_7_01.txt AC 6915 ms 728 KB
01_rnd_7_02.txt AC 6977 ms 724 KB
01_rnd_7_03.txt AC 7007 ms 748 KB
01_rnd_7_04.txt AC 6978 ms 724 KB
01_rnd_7_05.txt AC 6941 ms 724 KB
01_rnd_7_06.txt AC 6929 ms 724 KB
01_rnd_7_07.txt AC 6917 ms 740 KB
01_rnd_7_08.txt AC 6913 ms 728 KB
01_rnd_7_09.txt AC 6900 ms 728 KB
01_rnd_7_10.txt AC 6913 ms 736 KB
01_rnd_7_11.txt AC 6919 ms 752 KB
01_rnd_7_12.txt AC 4067 ms 736 KB
01_rnd_7_13.txt AC 6669 ms 660 KB
01_rnd_7_14.txt AC 4464 ms 728 KB
01_rnd_7_15.txt AC 3820 ms 672 KB
01_rnd_7_16.txt AC 6336 ms 724 KB
01_rnd_7_17.txt WA 2764 ms 736 KB
01_rnd_7_18.txt AC 4079 ms 724 KB
01_rnd_7_19.txt WA 1707 ms 664 KB
01_rnd_7_20.txt AC 2355 ms 712 KB
01_rnd_7_21.txt AC 4062 ms 660 KB
01_rnd_7_22.txt AC 1360 ms 728 KB
01_rnd_8_01.txt AC 7018 ms 668 KB
01_rnd_8_02.txt AC 7107 ms 748 KB
01_rnd_8_03.txt AC 7089 ms 724 KB
01_rnd_8_04.txt AC 7080 ms 728 KB
01_rnd_8_05.txt AC 7064 ms 660 KB
01_rnd_8_06.txt AC 7024 ms 724 KB
01_rnd_8_07.txt AC 7013 ms 728 KB
01_rnd_8_08.txt AC 7007 ms 652 KB
01_rnd_8_09.txt AC 7010 ms 724 KB
01_rnd_8_10.txt AC 7008 ms 724 KB
01_rnd_8_11.txt AC 7010 ms 720 KB
01_rnd_8_12.txt AC 4783 ms 748 KB
01_rnd_8_13.txt WA 799 ms 660 KB
01_rnd_8_14.txt WA 4848 ms 728 KB
01_rnd_8_15.txt WA 3548 ms 728 KB
01_rnd_8_16.txt WA 2849 ms 704 KB
01_rnd_8_17.txt AC 6398 ms 736 KB
01_rnd_8_18.txt WA 1409 ms 664 KB
01_rnd_8_19.txt WA 3503 ms 720 KB
01_rnd_8_20.txt AC 4773 ms 668 KB
01_rnd_8_21.txt WA 1403 ms 716 KB
01_rnd_8_22.txt AC 6357 ms 724 KB