Submission #19007


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){
      if(n==2){i=0; j=1;} else {
        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 100
Code Size 1041 Byte
Status AC
Exec Time 6326 ms
Memory 784 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 898 ms 660 KB
00_mini_02.txt AC 882 ms 660 KB
00_sample_01.txt AC 660 ms 660 KB
00_sample_02.txt AC 6326 ms 748 KB
00_sample_03.txt AC 967 ms 660 KB
01_rnd_11_01.txt AC 5051 ms 692 KB
01_rnd_11_02.txt AC 5090 ms 668 KB
01_rnd_11_03.txt AC 5128 ms 664 KB
01_rnd_11_04.txt AC 5140 ms 664 KB
01_rnd_11_05.txt AC 5133 ms 660 KB
01_rnd_11_06.txt AC 5116 ms 656 KB
01_rnd_11_07.txt AC 5105 ms 656 KB
01_rnd_11_08.txt AC 5086 ms 656 KB
01_rnd_11_09.txt AC 5079 ms 664 KB
01_rnd_11_10.txt AC 5080 ms 748 KB
01_rnd_11_11.txt AC 5065 ms 668 KB
01_rnd_11_12.txt AC 4355 ms 664 KB
01_rnd_11_13.txt AC 382 ms 660 KB
01_rnd_11_14.txt AC 982 ms 660 KB
01_rnd_11_15.txt AC 4924 ms 692 KB
01_rnd_11_16.txt AC 3101 ms 672 KB
01_rnd_11_17.txt AC 1901 ms 664 KB
01_rnd_11_18.txt AC 3510 ms 660 KB
01_rnd_11_19.txt AC 4641 ms 660 KB
01_rnd_11_20.txt AC 4625 ms 664 KB
01_rnd_11_21.txt AC 3026 ms 660 KB
01_rnd_11_22.txt AC 1830 ms 664 KB
01_rnd_7_01.txt AC 5576 ms 660 KB
01_rnd_7_02.txt AC 5671 ms 656 KB
01_rnd_7_03.txt AC 5690 ms 652 KB
01_rnd_7_04.txt AC 5663 ms 664 KB
01_rnd_7_05.txt AC 5626 ms 680 KB
01_rnd_7_06.txt AC 5614 ms 668 KB
01_rnd_7_07.txt AC 5603 ms 660 KB
01_rnd_7_08.txt AC 5588 ms 660 KB
01_rnd_7_09.txt AC 5582 ms 660 KB
01_rnd_7_10.txt AC 5586 ms 668 KB
01_rnd_7_11.txt AC 5577 ms 660 KB
01_rnd_7_12.txt AC 3230 ms 644 KB
01_rnd_7_13.txt AC 5414 ms 688 KB
01_rnd_7_14.txt AC 3593 ms 660 KB
01_rnd_7_15.txt AC 3050 ms 728 KB
01_rnd_7_16.txt AC 5120 ms 656 KB
01_rnd_7_17.txt AC 2191 ms 656 KB
01_rnd_7_18.txt AC 3252 ms 656 KB
01_rnd_7_19.txt AC 1364 ms 760 KB
01_rnd_7_20.txt AC 1885 ms 660 KB
01_rnd_7_21.txt AC 3237 ms 656 KB
01_rnd_7_22.txt AC 1097 ms 660 KB
01_rnd_8_01.txt AC 5350 ms 660 KB
01_rnd_8_02.txt AC 5443 ms 784 KB
01_rnd_8_03.txt AC 5489 ms 660 KB
01_rnd_8_04.txt AC 5451 ms 660 KB
01_rnd_8_05.txt AC 5434 ms 692 KB
01_rnd_8_06.txt AC 5402 ms 668 KB
01_rnd_8_07.txt AC 5409 ms 732 KB
01_rnd_8_08.txt AC 5376 ms 660 KB
01_rnd_8_09.txt AC 5361 ms 664 KB
01_rnd_8_10.txt AC 5373 ms 660 KB
01_rnd_8_11.txt AC 5360 ms 656 KB
01_rnd_8_12.txt AC 3617 ms 660 KB
01_rnd_8_13.txt AC 696 ms 764 KB
01_rnd_8_14.txt AC 3741 ms 652 KB
01_rnd_8_15.txt AC 2701 ms 660 KB
01_rnd_8_16.txt AC 2173 ms 664 KB
01_rnd_8_17.txt AC 4900 ms 784 KB
01_rnd_8_18.txt AC 1115 ms 660 KB
01_rnd_8_19.txt AC 2637 ms 660 KB
01_rnd_8_20.txt AC 3650 ms 660 KB
01_rnd_8_21.txt AC 1102 ms 664 KB
01_rnd_8_22.txt AC 4862 ms 660 KB