Submission #18901


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,12000000){
    rep(i,n) now[i] = i;
    rep(l,k){
      do{
        i = myrand() % n;
        j = myrand() % n;
      }while(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 986 Byte
Status TLE
Exec Time 10031 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 0 / 100
Status
AC × 69
TLE × 2
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 TLE 10031 ms 764 KB
00_mini_02.txt TLE 10030 ms 752 KB
00_sample_01.txt AC 651 ms 656 KB
00_sample_02.txt AC 6245 ms 656 KB
00_sample_03.txt AC 964 ms 660 KB
01_rnd_11_01.txt AC 5002 ms 656 KB
01_rnd_11_02.txt AC 5054 ms 660 KB
01_rnd_11_03.txt AC 5091 ms 660 KB
01_rnd_11_04.txt AC 5109 ms 668 KB
01_rnd_11_05.txt AC 5087 ms 656 KB
01_rnd_11_06.txt AC 5085 ms 652 KB
01_rnd_11_07.txt AC 5082 ms 728 KB
01_rnd_11_08.txt AC 5050 ms 664 KB
01_rnd_11_09.txt AC 5044 ms 664 KB
01_rnd_11_10.txt AC 5022 ms 664 KB
01_rnd_11_11.txt AC 5019 ms 688 KB
01_rnd_11_12.txt AC 4327 ms 664 KB
01_rnd_11_13.txt AC 368 ms 656 KB
01_rnd_11_14.txt AC 977 ms 664 KB
01_rnd_11_15.txt AC 4883 ms 664 KB
01_rnd_11_16.txt AC 3077 ms 664 KB
01_rnd_11_17.txt AC 1906 ms 656 KB
01_rnd_11_18.txt AC 3495 ms 664 KB
01_rnd_11_19.txt AC 4614 ms 656 KB
01_rnd_11_20.txt AC 4586 ms 692 KB
01_rnd_11_21.txt AC 3000 ms 660 KB
01_rnd_11_22.txt AC 1834 ms 660 KB
01_rnd_7_01.txt AC 5473 ms 660 KB
01_rnd_7_02.txt AC 5554 ms 660 KB
01_rnd_7_03.txt AC 5564 ms 772 KB
01_rnd_7_04.txt AC 5538 ms 664 KB
01_rnd_7_05.txt AC 5516 ms 656 KB
01_rnd_7_06.txt AC 5499 ms 660 KB
01_rnd_7_07.txt AC 5501 ms 664 KB
01_rnd_7_08.txt AC 5483 ms 652 KB
01_rnd_7_09.txt AC 5481 ms 668 KB
01_rnd_7_10.txt AC 5490 ms 660 KB
01_rnd_7_11.txt AC 5495 ms 728 KB
01_rnd_7_12.txt AC 3180 ms 652 KB
01_rnd_7_13.txt AC 5298 ms 660 KB
01_rnd_7_14.txt AC 3533 ms 660 KB
01_rnd_7_15.txt AC 3013 ms 660 KB
01_rnd_7_16.txt AC 5020 ms 688 KB
01_rnd_7_17.txt AC 2177 ms 660 KB
01_rnd_7_18.txt AC 3221 ms 664 KB
01_rnd_7_19.txt AC 1371 ms 668 KB
01_rnd_7_20.txt AC 1873 ms 656 KB
01_rnd_7_21.txt AC 3189 ms 660 KB
01_rnd_7_22.txt AC 1100 ms 688 KB
01_rnd_8_01.txt AC 5254 ms 656 KB
01_rnd_8_02.txt AC 5340 ms 652 KB
01_rnd_8_03.txt AC 5364 ms 664 KB
01_rnd_8_04.txt AC 5362 ms 732 KB
01_rnd_8_05.txt AC 5329 ms 664 KB
01_rnd_8_06.txt AC 5301 ms 660 KB
01_rnd_8_07.txt AC 5290 ms 660 KB
01_rnd_8_08.txt AC 5283 ms 664 KB
01_rnd_8_09.txt AC 5276 ms 660 KB
01_rnd_8_10.txt AC 5270 ms 688 KB
01_rnd_8_11.txt AC 5258 ms 660 KB
01_rnd_8_12.txt AC 3552 ms 816 KB
01_rnd_8_13.txt AC 684 ms 660 KB
01_rnd_8_14.txt AC 3666 ms 668 KB
01_rnd_8_15.txt AC 2652 ms 668 KB
01_rnd_8_16.txt AC 2134 ms 664 KB
01_rnd_8_17.txt AC 4827 ms 728 KB
01_rnd_8_18.txt AC 1099 ms 668 KB
01_rnd_8_19.txt AC 2594 ms 656 KB
01_rnd_8_20.txt AC 3571 ms 656 KB
01_rnd_8_21.txt AC 1084 ms 660 KB
01_rnd_8_22.txt AC 4779 ms 664 KB