Submission #18770


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,5000000){
    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 976 Byte
Status WA
Exec Time 2727 ms
Memory 828 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 × 56
WA × 15
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 1399 ms 668 KB
00_mini_02.txt AC 1397 ms 784 KB
00_sample_01.txt AC 253 ms 652 KB
00_sample_02.txt AC 2418 ms 656 KB
00_sample_03.txt WA 391 ms 660 KB
01_rnd_11_01.txt AC 2683 ms 664 KB
01_rnd_11_02.txt AC 2722 ms 748 KB
01_rnd_11_03.txt AC 2718 ms 660 KB
01_rnd_11_04.txt AC 2727 ms 688 KB
01_rnd_11_05.txt AC 2722 ms 644 KB
01_rnd_11_06.txt AC 2717 ms 664 KB
01_rnd_11_07.txt AC 2714 ms 660 KB
01_rnd_11_08.txt AC 2708 ms 648 KB
01_rnd_11_09.txt AC 2699 ms 664 KB
01_rnd_11_10.txt AC 2699 ms 656 KB
01_rnd_11_11.txt AC 2701 ms 660 KB
01_rnd_11_12.txt AC 2312 ms 700 KB
01_rnd_11_13.txt AC 175 ms 688 KB
01_rnd_11_14.txt WA 467 ms 664 KB
01_rnd_11_15.txt WA 2608 ms 656 KB
01_rnd_11_16.txt WA 1621 ms 660 KB
01_rnd_11_17.txt WA 971 ms 664 KB
01_rnd_11_18.txt AC 1847 ms 668 KB
01_rnd_11_19.txt AC 2462 ms 660 KB
01_rnd_11_20.txt AC 2454 ms 664 KB
01_rnd_11_21.txt WA 1587 ms 652 KB
01_rnd_11_22.txt WA 943 ms 708 KB
01_rnd_7_01.txt AC 2554 ms 656 KB
01_rnd_7_02.txt AC 2587 ms 660 KB
01_rnd_7_03.txt AC 2592 ms 668 KB
01_rnd_7_04.txt AC 2595 ms 728 KB
01_rnd_7_05.txt AC 2577 ms 652 KB
01_rnd_7_06.txt AC 2570 ms 704 KB
01_rnd_7_07.txt AC 2565 ms 652 KB
01_rnd_7_08.txt AC 2563 ms 636 KB
01_rnd_7_09.txt AC 2559 ms 664 KB
01_rnd_7_10.txt AC 2557 ms 640 KB
01_rnd_7_11.txt AC 2558 ms 660 KB
01_rnd_7_12.txt AC 1482 ms 668 KB
01_rnd_7_13.txt AC 2472 ms 656 KB
01_rnd_7_14.txt AC 1643 ms 660 KB
01_rnd_7_15.txt AC 1396 ms 688 KB
01_rnd_7_16.txt AC 2340 ms 656 KB
01_rnd_7_17.txt WA 1017 ms 664 KB
01_rnd_7_18.txt AC 1495 ms 660 KB
01_rnd_7_19.txt AC 630 ms 668 KB
01_rnd_7_20.txt AC 868 ms 672 KB
01_rnd_7_21.txt AC 1484 ms 668 KB
01_rnd_7_22.txt AC 503 ms 816 KB
01_rnd_8_01.txt AC 2590 ms 660 KB
01_rnd_8_02.txt AC 2620 ms 660 KB
01_rnd_8_03.txt AC 2633 ms 692 KB
01_rnd_8_04.txt AC 2624 ms 660 KB
01_rnd_8_05.txt AC 2616 ms 796 KB
01_rnd_8_06.txt AC 2612 ms 656 KB
01_rnd_8_07.txt AC 2605 ms 828 KB
01_rnd_8_08.txt AC 2620 ms 728 KB
01_rnd_8_09.txt AC 2596 ms 664 KB
01_rnd_8_10.txt AC 2597 ms 660 KB
01_rnd_8_11.txt AC 2595 ms 664 KB
01_rnd_8_12.txt AC 1744 ms 652 KB
01_rnd_8_13.txt WA 299 ms 696 KB
01_rnd_8_14.txt WA 1788 ms 684 KB
01_rnd_8_15.txt WA 1292 ms 664 KB
01_rnd_8_16.txt WA 1047 ms 660 KB
01_rnd_8_17.txt AC 2362 ms 664 KB
01_rnd_8_18.txt WA 522 ms 664 KB
01_rnd_8_19.txt WA 1277 ms 660 KB
01_rnd_8_20.txt AC 1757 ms 660 KB
01_rnd_8_21.txt WA 518 ms 660 KB
01_rnd_8_22.txt AC 2355 ms 652 KB